123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <template>
- <view>
- <uni-drawer ref="drawerShow" :mode="drawer.mode" :maskClick="true" :width="290" @change="drawerChange">
- <view class="drawer">
- <view class="drawer_1">
- <view class="left textOver">
- {{drawer.title||'弹窗'}}
- </view>
- <view class="right">
- <uni-icons type="clear" size="30" @tap="toClose()"></uni-icons>
- </view>
- </view>
- <view class="drawer_2">
- <scroll-view scroll-y="true" class="scroll-view">
- <view class="list-scroll-view">
- <view class="info">
- <slot></slot>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </uni-drawer>
- </view>
- </template>
- <script>
- export default {
- props: {
- drawer: {
- type: Object
- }
- },
- data() {
- return {};
- },
- methods: {
- drawerChange(e) {
- const that = this;
- if (e == false) that.$emit('toClose')
- },
- drawerOpen() {
- const that = this;
- that.$refs.drawerShow.open();
- },
- toClose() {
- const that = this;
- that.$emit('toClose')
- },
- drawerClose() {
- const that = this;
- that.$refs.drawerShow.close();
- }
- },
- watch: {
- drawer(newVal, oldVal) {
- const that = this;
- if (newVal.show == true && oldVal.show == false) that.drawerOpen();
- else if (newVal.show == false && oldVal.show == true) that.drawerClose();
- }
- }
- }
- </script>
- <style lang="scss">
- .drawer {
- display: flex;
- flex-direction: column;
- width: 77vw;
- height: 100vh;
- .drawer_1 {
- display: flex;
- justify-content: space-between;
- padding: 2vw;
- .left {
- flex-grow: 1;
- font-weight: bold;
- padding: 1vw 0;
- font-size: 16px;
- font-family: monospace;
- }
- }
- .drawer_2 {
- flex-grow: 1;
- position: relative;
- padding: 0 2vw;
- .info {
- padding: 0 2vw;
- }
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: column;
- padding: 0 !important;
- }
- }
- </style>
|