@xizs/nuxt-antui 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/composables/antdv.ts +5 -0
- package/app/composables/modal.ts +20 -42
- package/package.json +1 -1
package/app/composables/modal.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createVNode, render } from "vue"
|
|
2
2
|
import Form from "../components/global/Form"
|
|
3
|
-
import { AModal } from "#components"
|
|
3
|
+
import { AConfigProvider, AModal } from "#components"
|
|
4
|
+
|
|
5
|
+
import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
|
4
6
|
|
|
5
7
|
export const NormalModal = (el) => {
|
|
6
8
|
let control = { close: () => { } }
|
|
@@ -12,27 +14,29 @@ export const NormalModal = (el) => {
|
|
|
12
14
|
control.close = () => {
|
|
13
15
|
open.value = false
|
|
14
16
|
}
|
|
15
|
-
return () => h(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
open
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
container.parentNode
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
return () => h(AConfigProvider, { locale: useAntLocale().value }, [
|
|
18
|
+
h(el, {
|
|
19
|
+
open: open.value, // 等价于 v-model:open
|
|
20
|
+
'onUpdate:open': (val: boolean) => {
|
|
21
|
+
open.value = val
|
|
22
|
+
if (!val) {
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
render(null, container) // 卸载组件
|
|
25
|
+
if (container.parentNode) {
|
|
26
|
+
container.parentNode.removeChild(container) // 移除 DOM
|
|
27
|
+
}
|
|
28
|
+
}, 1000);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
])
|
|
29
33
|
}
|
|
30
34
|
})
|
|
31
35
|
|
|
32
36
|
const vnode = h(com)
|
|
33
37
|
vnode.appContext = useNuxtApp().vueApp._context
|
|
34
38
|
render(vnode, container)
|
|
35
|
-
document.
|
|
39
|
+
// document.getElementById('aaaa')!.appendChild(container)
|
|
36
40
|
|
|
37
41
|
return control
|
|
38
42
|
|
|
@@ -55,32 +59,6 @@ export const FormModal = (params: FormModalParamsType) => {
|
|
|
55
59
|
|
|
56
60
|
let submit: () => void
|
|
57
61
|
|
|
58
|
-
// let control = NormalModal(h(AModal,{
|
|
59
|
-
// title: params.title,
|
|
60
|
-
// okText: '提交'+loading?.value,
|
|
61
|
-
// cancelText: '取消',
|
|
62
|
-
// onOk: async ()=>{
|
|
63
|
-
// await submit()
|
|
64
|
-
// control.close()
|
|
65
|
-
// }
|
|
66
|
-
|
|
67
|
-
// },h(defineComponent({
|
|
68
|
-
// setup(){
|
|
69
|
-
// let formRef = ref(null)
|
|
70
|
-
|
|
71
|
-
// onMounted(()=>{
|
|
72
|
-
// submit = formRef.value.submit
|
|
73
|
-
// loading = formRef.value.loading
|
|
74
|
-
// })
|
|
75
|
-
|
|
76
|
-
// return ()=>h(Form,{
|
|
77
|
-
// ref: formRef,
|
|
78
|
-
// form: params.form,
|
|
79
|
-
// submit:params.submit,
|
|
80
|
-
// showSubmit: false
|
|
81
|
-
// })
|
|
82
|
-
// }
|
|
83
|
-
// }))))
|
|
84
62
|
|
|
85
63
|
let control = NormalModal(h(defineComponent({
|
|
86
64
|
setup() {
|