Skip to content

Commit

Permalink
fix(swiper): 在动态修改height值后,组件视图未更新 (jdf2e#2485)
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-boide committed Oct 30, 2023
1 parent 9e42ed2 commit a4762ea
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/packages/__VUE/swiper/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,18 @@ export default create({
}
);
watch(
() => props.height,
(val) => {
Taro.nextTick(() => {
init(+val);
});
eventCenter.once((getCurrentInstance() as any).router.onReady, () => {
init(+val);
});
}
);
watch(
() => state.children.length,
() => {
Expand Down
9 changes: 9 additions & 0 deletions src/packages/__VUE/swiper/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,15 @@ export default create({
}
);
watch(
() => props.height,
(val) => {
nextTick(() => {
init(Number(val));
});
}
);
watch(
() => state.children.length,
() => {
Expand Down

0 comments on commit a4762ea

Please sign in to comment.