Исправлен баг выпадающих списков в оглавлении
This commit is contained in:
@@ -321,21 +321,25 @@ class ContentsPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFirstElem(items) {
|
||||||
|
return (Array.isArray(items) ? items[0] : items);
|
||||||
|
}
|
||||||
|
|
||||||
async expandClick(key) {
|
async expandClick(key) {
|
||||||
const item = this.contents[key];
|
const item = this.contents[key];
|
||||||
const expanded = !item.expanded;
|
const expanded = !item.expanded;
|
||||||
|
|
||||||
if (!expanded) {
|
if (!expanded) {
|
||||||
const subitems = this.$refs[`subitem${key}`];
|
let subitems = this.getFirstElem(this.$refs[`subitem${key}`]);
|
||||||
subitems.style.height = '0';
|
subitems.style.height = '0';
|
||||||
await utils.sleep(200);
|
await utils.sleep(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.contents[key] = Object.assign({}, item, {expanded});
|
this.contents[key].expanded = expanded;
|
||||||
|
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
await this.$nextTick();
|
await this.$nextTick();
|
||||||
const subitems = this.$refs[`subitem${key}`];
|
let subitems = this.getFirstElem(this.$refs[`subitem${key}`]);
|
||||||
subitems.style.height = subitems.scrollHeight + 'px';
|
subitems.style.height = subitems.scrollHeight + 'px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user