@mythpe/quasar-ui-qui 0.2.32 → 0.2.33
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/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import type { MAxiosProps as Props, MSelectModelEmit, MSelectSlots } from '../../types'
|
|
15
15
|
import { computed, onMounted, toValue, useTemplateRef, watch } from 'vue'
|
|
16
|
-
import { useSetFieldValue } from 'vee-validate'
|
|
16
|
+
import { useFieldValue, useSetFieldValue } from 'vee-validate'
|
|
17
17
|
import MSelect from './MSelect.vue'
|
|
18
18
|
import { useMyth } from '../../composable'
|
|
19
19
|
|
|
@@ -51,6 +51,7 @@ type Emits = {
|
|
|
51
51
|
const emit = defineEmits<Emits>()
|
|
52
52
|
const search = defineModel<string>('search', { required: !1, default: '' })
|
|
53
53
|
const setFieldValue = useSetFieldValue(() => props.name)
|
|
54
|
+
const fieldValue = useFieldValue(() => props.name)
|
|
54
55
|
const { alertError, api } = useMyth()
|
|
55
56
|
const loading = defineModel<Props['loading']>('loading', { required: !1, default: !1 })
|
|
56
57
|
const items = defineModel<Props['items']>('items', { required: !1, default: [] })
|
|
@@ -58,7 +59,7 @@ const isGuest = computed(() => {
|
|
|
58
59
|
const v = toValue(props.guest)
|
|
59
60
|
return v !== undefined && v !== null && v !== !1
|
|
60
61
|
})
|
|
61
|
-
const prepare = async (fromWatch = !1) => {
|
|
62
|
+
const prepare = async (fromWatch = !1, merge = {}) => {
|
|
62
63
|
if (!props.service || loading.value) {
|
|
63
64
|
return
|
|
64
65
|
}
|
|
@@ -81,6 +82,7 @@ const prepare = async (fromWatch = !1) => {
|
|
|
81
82
|
throw Error(`No service: ${props.service}`)
|
|
82
83
|
}
|
|
83
84
|
const params: any = {
|
|
85
|
+
...merge,
|
|
84
86
|
requestWith: undefined,
|
|
85
87
|
search: search.value,
|
|
86
88
|
itemsPerPage: -1,
|
|
@@ -116,6 +118,12 @@ const listeners = {
|
|
|
116
118
|
onMounted(() => {
|
|
117
119
|
if (!props.lazy) {
|
|
118
120
|
prepare()
|
|
121
|
+
} else {
|
|
122
|
+
if (fieldValue.value) {
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
prepare(!1, { filter: { id: fieldValue.value } })
|
|
125
|
+
}, 300)
|
|
126
|
+
}
|
|
119
127
|
}
|
|
120
128
|
})
|
|
121
129
|
watch(() => toValue(props.params), () => prepare(!0), { deep: !0 })
|