白色主题

This commit is contained in:
2023-02-12 19:04:01 +08:00
parent d736a5912f
commit 57ab6fbb49
411 changed files with 1752 additions and 5304 deletions

View File

@@ -142,6 +142,9 @@ let Indexes = class Indexes extends SuperComponent {
this.preIndex = index;
this.toggleTips(true);
this.triggerEvent('select', { index: activeAnchor });
if (activeAnchor !== this.data.activeAnchor) {
this.triggerEvent('change', { index: activeAnchor });
}
},
onClick(e) {
const { index } = e.currentTarget.dataset;
@@ -175,32 +178,36 @@ let Indexes = class Indexes extends SuperComponent {
if (!this.groupTop) {
return;
}
const { sticky } = this.data;
const { sticky, stickyOffset } = this.data;
scrollTop += stickyOffset;
const curIndex = this.groupTop.findIndex((group) => scrollTop >= group.top - group.height && scrollTop <= group.top + group.totalHeight - group.height);
if (curIndex === -1)
return;
const curGroup = this.groupTop[curIndex];
if (this.data.activeAnchor !== curGroup.anchor) {
this.triggerEvent('change', { index: curGroup.anchor });
}
this.setData({
activeAnchor: curGroup.anchor,
});
if (sticky) {
const offset = curGroup.top - scrollTop;
const betwixt = offset < curGroup.height && offset > 0 && scrollTop > 0;
const betwixt = offset < curGroup.height && offset > 0 && scrollTop > stickyOffset;
this.$children.forEach((child, index) => {
if (index === curIndex) {
child.setData({
sticky: scrollTop > 0,
sticky: scrollTop > stickyOffset,
active: true,
customStyle: `height: ${curGroup.height}px`,
anchorStyle: `transform: translate3d(0, ${betwixt ? offset : 0}px, 0)`,
style: `height: ${curGroup.height}px`,
anchorStyle: `transform: translate3d(0, ${betwixt ? offset : 0}px, 0); top: ${stickyOffset}px`,
});
}
else if (index + 1 === curIndex) {
child.setData({
sticky: true,
active: true,
customStyle: `height: ${curGroup.height}px`,
anchorStyle: `transform: translate3d(0, ${betwixt ? offset - curGroup.height : 0}px, 0)`,
style: `height: ${curGroup.height}px`,
anchorStyle: `transform: translate3d(0, ${betwixt ? offset - curGroup.height : 0}px, 0); top: ${stickyOffset}px`,
});
}
else {