mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-09-06 16:09:44 +08:00
parent
3adba1a67b
commit
a54f0af5dd
@ -30,6 +30,7 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.observeContainer();
|
this.observeContainer();
|
||||||
|
this.updateFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -63,6 +64,22 @@ VantComponent({
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateFixed() {
|
||||||
|
Promise.all([this.getRect(ROOT_ELEMENT), this.getContainerRect()]).then(
|
||||||
|
([
|
||||||
|
content,
|
||||||
|
container
|
||||||
|
]: WechatMiniprogram.BoundingClientRectCallbackResult[]) => {
|
||||||
|
this.setData({ height: content.height });
|
||||||
|
this.containerHeight = container.height;
|
||||||
|
|
||||||
|
wx.nextTick(() => {
|
||||||
|
this.setFixed(content.top);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
disconnectObserver(observerName?: string) {
|
disconnectObserver(observerName?: string) {
|
||||||
if (observerName) {
|
if (observerName) {
|
||||||
const observer: WechatMiniprogram.IntersectionObserver = this[
|
const observer: WechatMiniprogram.IntersectionObserver = this[
|
||||||
|
@ -114,15 +114,19 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.setData({
|
wx.nextTick(() => {
|
||||||
container: () => this.createSelectorQuery().select('.van-tabs')
|
|
||||||
}, () => {
|
|
||||||
this.setLine(true);
|
this.setLine(true);
|
||||||
this.scrollIntoView();
|
this.scrollIntoView();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
updateContainer() {
|
||||||
|
this.setData({
|
||||||
|
container: () => this.createSelectorQuery().select('.van-tabs')
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
updateTabs() {
|
updateTabs() {
|
||||||
const { children = [], data } = this;
|
const { children = [], data } = this;
|
||||||
this.setData({
|
this.setData({
|
||||||
@ -203,6 +207,7 @@ VantComponent({
|
|||||||
wx.nextTick(() => {
|
wx.nextTick(() => {
|
||||||
this.setLine();
|
this.setLine();
|
||||||
this.scrollIntoView();
|
this.scrollIntoView();
|
||||||
|
this.updateContainer();
|
||||||
|
|
||||||
this.trigger('input');
|
this.trigger('input');
|
||||||
if (shouldEmitChange) {
|
if (shouldEmitChange) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user