index.vue 617 B

1234567891011121314151617181920212223242526272829
  1. <script lang="ts" setup>
  2. import { useVbenDrawer, VbenButton } from '@vben/common-ui';
  3. import ExtraDrawer from './drawer.vue';
  4. const [Drawer, drawerApi] = useVbenDrawer({
  5. // 连接抽离的组件
  6. connectedComponent: ExtraDrawer,
  7. });
  8. function open() {
  9. drawerApi.open();
  10. }
  11. function handleUpdateTitle() {
  12. drawerApi.setState({ title: '外部动态标题' }).open();
  13. }
  14. </script>
  15. <template>
  16. <div>
  17. <Drawer />
  18. <VbenButton @click="open">Open</VbenButton>
  19. <VbenButton class="ml-2" type="primary" @click="handleUpdateTitle">
  20. 从外部修改标题并打开
  21. </VbenButton>
  22. </div>
  23. </template>