当我使用 ANTD DatePicker 并使用箭头转到下一个面板时。UI 更新,但我无法从 HTMLCollection 或 NodeList 中提取实时值。
第一次打开面板:
var yrCell = document.getElementsByClassName("ant-calendar-year-panel-year");
console.log(yrCell) // logs 2019-2030 in a HTMLCollection
for (let item of yrCell) {
console.log(item.innerText); // logs 2019-2030
}
for (let i = 0; i < yrCell.length; i++) {
console.log(yrCell[i]); // logs 2019-2030
}
console.log(yrCell) // logs 2019-2030 in a HTMLCollection
var yrCell = document.getElementsByClassName("ant-calendar-year-panel-year");
console.log(yrCell) // logs 2029-2040 in a HTMLCollection
for (let item of yrCell) {
console.log(item.innerText); // STILL logs 2019-2030
}
for (let i = 0; i < yrCell.length; i++) {
console.log(yrCell[i]); // STILL logs 2019-2030
}
console.log(yrCell) // logs 2029-2040 in a HTMLCollection
如果 HTMLCollection 已更新并且 UI 已更新并 siaplays '后来的'值,并且在我的代码中,我在尝试从中提取特定值之前和之后读取较新的值,这些值如何不存在?
任何帮助真的很感激!