parent
fdd583b1b5
commit
1b6671a6a7
6 changed files with 129 additions and 5 deletions
|
|
@ -18,7 +18,7 @@
|
|||
:style="{ top: `${isMove ? y : calcY()}px` }"
|
||||
>
|
||||
<div class="bottom-sheet-handle"><div class="bottom-sheet-handle-decoration" /></div>
|
||||
<div style="position:absolute;top:20px;left:0;right:0;bottom:0;overflow-y:auto;padding:20px">
|
||||
<div ref="sheetContent" style="position:absolute;top:20px;left:0;right:0;bottom:0;overflow-y:auto;padding:20px">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -119,6 +119,9 @@ export default {
|
|||
},
|
||||
setState(state) {
|
||||
this.state = state;
|
||||
if (state == "closed") {
|
||||
this.scrollToTop();
|
||||
}
|
||||
},
|
||||
onBackgroundClick() {
|
||||
if (this.state == "open") {
|
||||
|
|
@ -127,6 +130,12 @@ export default {
|
|||
this.setState("closed");
|
||||
}
|
||||
},
|
||||
scrollToTop() {
|
||||
const container = this.$refs.sheetContent;
|
||||
if (container) {
|
||||
container.scrollTo(0, 0);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue