diff --git a/src/components/GlobalDialog.vue b/src/components/GlobalDialog.vue index a383808..45c5375 100644 --- a/src/components/GlobalDialog.vue +++ b/src/components/GlobalDialog.vue @@ -63,21 +63,23 @@ const BUTTONS = { ], }; -const DefaultConfig = { - dialog: { - width: '25%', - } -}; +const DefaultDialogWidth = '25%' export default { - setup() { + setup(_: any, ctx: any) { const mutations = useMutations(['closeDialog']); const { config: userConfig } = useState(['config'], 'dialog'); const config = computed(() => { if (!userConfig.value) { return null; } - return Object.assign({}, DefaultConfig, userConfig.value) as DialogConfig; + const o = Object.assign({dialog: {}}, userConfig.value) as DialogConfig; + + if (!('width' in o.dialog)) { + o.dialog.width = ctx.root.$vuetify.breakpoint.smAndDown ? null : DefaultDialogWidth + } + + return o }); const value = ref(); const input = ref(); diff --git a/src/store/types.ts b/src/store/types.ts index fb96f38..937e37e 100644 --- a/src/store/types.ts +++ b/src/store/types.ts @@ -41,9 +41,7 @@ export enum DialogType { } export interface DialogConfig { - dialog?: { - width?: string; - }; + dialog?: any; title?: string; text: string;