feat: 添加 useDialogRef 函数,优化对话框引用管理,更新对话框组件逻辑
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<script lang="ts"></script>
|
||||
|
||||
<script setup lang="tsx">
|
||||
import { ConfirmationService, DialogService, ToastService } from '@/utils/primevue';
|
||||
import { ConfirmationService, DialogService, ToastService, useDialogRef } from '@/utils/primevue';
|
||||
import dialogContent from './dialog-content.vue';
|
||||
|
||||
const dynamicComponent = defineComponent({
|
||||
@ -12,7 +12,7 @@ const dynamicComponent = defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const dialogRef = inject<ComputedRef<DynamicDialogOptions>>('dialogRef');
|
||||
const dialogRef = useDialogRef();
|
||||
return () => (
|
||||
<div>
|
||||
<button onClick={() => ctx.emit('close')}>emit('close')</button> <hr />
|
||||
@ -55,7 +55,6 @@ const openDialog = async () => {
|
||||
DialogService.open(dialogContent, {
|
||||
props: {
|
||||
header: '对话框2',
|
||||
position: 'bottomright',
|
||||
// draggable: false, // Header1的 draggable: true 会影响 Header2,如果指定 draggable: false,则不会受到影响。
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user