tiny-vue
tiny-vue copied to clipboard
✨ [Feature]: Drawer组件可以新增打开时的回调函数open
What problem does this feature solve
虽然我们可以通过watch组件的visible属性来判断是打开还是关闭状态从而触发相应的回调函数,但新增open回调函数可以降低用户的心智负担
What does the proposed API look like
<template>
<div>
<tiny-button @click="fn" type="primary"> 打开事件示例 </tiny-button>
<tiny-drawer title="标题" :show-footer="true" :visible="visible" @update:visible="visible = $event" @open="open">
<div style="height: 200px; text-align: center">
<br />
<br />
<span>内容区域</span>
</div>
</tiny-drawer>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { Drawer as TinyDrawer, Button as TinyButton, Modal } from '@opentiny/vue'
const visible = ref(false)
function fn() {
visible.value = true
}
function open() {
Modal.message('打开事件')
}
</script>
Bot detected the issue body's language is not English, translate it automatically.
Title: ✨ [Feature]: The Drawer component can add a callback function open when it is opened.
已新增打开时的事件回调open:https://opentiny.design/tiny-vue/zh-CN/os-theme/components/drawer#events