main
vue 38 lines 1.02 KB
Raw
1 <template>
2 <n-button size="small" secondary :loading @click="showForm = true">
3 <template #icon>
4 <Icon :name="SettingsIcon" :size="14" />
5 </template>
6 Default Settings
7 </n-button>
8
9 <n-modal
10 v-model:show="showForm"
11 display-directive="show"
12 preset="card"
13 :style="{ maxWidth: 'min(600px, 90vw)', minHeight: 'min(300px, 90vh)', overflow: 'hidden' }"
14 title="Customer Provisioning Default Settings"
15 :bordered="false"
16 segmented
17 >
18 <CustomerDefaultSettingsForm v-model:loading="loading" @mounted="settingsFormCTX = $event" />
19 </n-modal>
20 </template>
21
22 <script setup lang="ts">
23 import { NButton, NModal } from "naive-ui"
24 import { ref, watch } from "vue"
25 import Icon from "@/components/common/Icon.vue"
26 import CustomerDefaultSettingsForm from "./CustomerDefaultSettingsForm.vue"
27
28 const SettingsIcon = "carbon:settings-edit"
29 const settingsFormCTX = ref<{ load: () => void } | null>(null)
30 const showForm = ref(false)
31 const loading = ref(false)
32
33 watch(showForm, val => {
34 if (val) {
35 settingsFormCTX.value?.load()
36 }
37 })
38 </script>