Skip to content

Commit 4bf8e47

Browse files
committed
fix(ActionSheet): move initialization to observer for better visibility handling
1 parent bf78ec4 commit 4bf8e47

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/action-sheet/action-sheet.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ export default class ActionSheet extends SuperComponent {
3636
},
3737
];
3838

39-
ready() {
40-
this.memoInitialData();
41-
this.splitGridThemeActions();
42-
}
39+
observers = {
40+
visible(value: boolean) {
41+
if (!value) return;
42+
this.memoInitialData();
43+
this.splitGridThemeActions();
44+
},
45+
};
4346

4447
methods = {
4548
onSwiperChange(e: WechatMiniprogram.TouchEvent) {
@@ -65,7 +68,6 @@ export default class ActionSheet extends SuperComponent {
6568
...options,
6669
visible: true,
6770
});
68-
this.splitGridThemeActions();
6971
this.autoClose = true;
7072
this._trigger('visible-change', { visible: true });
7173
},

0 commit comments

Comments
 (0)