1234567891011121314151617181920 |
- import { inject, InjectionKey } from 'vue'
- export interface DialogShowOptions {
- title: string
- content: string
- path: string
- image: string
- }
- export const HonorDialogSymbol: InjectionKey<{
- show: (options: DialogShowOptions) => void
- }> = Symbol.for('HonorDialogContext')
- export const useHonorDialog = () => {
- const honorDialog = inject(HonorDialogSymbol)
- // if (!honorDialog) {
- // throw new Error('useHonorDialog must be used inside setup()')
- // }
- const show = computed(() => honorDialog?.show)
- return {
- show,
- }
- }
|