tiny-vue/examples/sites/demos/pc/app/drawer/placement.vue

51 lines
1.1 KiB
Vue

<template>
<div>
<tiny-button @click="openDrawer('left')"> left </tiny-button>
<tiny-button @click="openDrawer('right')"> right </tiny-button>
<tiny-button @click="openDrawer('top')"> top </tiny-button>
<tiny-button @click="openDrawer('bottom')"> bottom </tiny-button>
<tiny-drawer
v-if="placement === 'left' || placement === 'right'"
title="标题"
:placement="placement"
v-model:visible="visible"
height="600px"
>
<div>left或者right内容区域</div>
</tiny-drawer>
<tiny-drawer
v-if="placement === 'top' || placement === 'bottom'"
title="标题"
:placement="placement"
v-model:visible="visible"
height="400px"
>
<div>top或者bottom区域</div>
</tiny-drawer>
</div>
</template>
<script>
import { TinyDrawer, TinyButton } from '@opentiny/vue'
export default {
components: {
TinyDrawer,
TinyButton
},
data() {
return {
visible: false,
placement: 'right'
}
},
methods: {
openDrawer(side) {
this.placement = side
this.visible = true
}
}
}
</script>