@mythpe/quasar-ui-qui 0.1.86 → 0.1.87
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
|
@@ -11,17 +11,21 @@
|
|
|
11
11
|
setup
|
|
12
12
|
>
|
|
13
13
|
import type { MInputProps as Props, MInputSlots } from '../../types'
|
|
14
|
-
import { computed, toValue, useTemplateRef } from 'vue'
|
|
14
|
+
import { computed, toValue, useAttrs, useTemplateRef } from 'vue'
|
|
15
15
|
import MInput from './MInput.vue'
|
|
16
16
|
import { useMyth } from '../../composable'
|
|
17
|
+
import { useFieldValue } from 'vee-validate'
|
|
17
18
|
|
|
18
19
|
const { props: pluginOptions, mobileRule: mobile } = useMyth()
|
|
19
20
|
const modelValue = defineModel<Props['modelValue']>({ required: !1, default: undefined })
|
|
21
|
+
const attrs = useAttrs()
|
|
22
|
+
const name = computed<string>(() => (attrs.name as string) || '')
|
|
20
23
|
const input = useTemplateRef<InstanceType<typeof MInput>>('input')
|
|
24
|
+
const field = useFieldValue(name)
|
|
21
25
|
const mobileLength = computed(() => {
|
|
22
26
|
const final = toValue(mobile)
|
|
23
27
|
if (typeof final === 'function') {
|
|
24
|
-
return final(
|
|
28
|
+
return final(field.value)
|
|
25
29
|
}
|
|
26
30
|
if (final === !0) {
|
|
27
31
|
return 10
|
|
@@ -44,7 +48,7 @@ defineOptions({
|
|
|
44
48
|
v-model="modelValue"
|
|
45
49
|
v-bind="{
|
|
46
50
|
type: 'tel',
|
|
47
|
-
mobile: typeof mobile === 'function' ? mobile(
|
|
51
|
+
mobile: typeof mobile === 'function' ? mobile(field) : (
|
|
48
52
|
mobile !== !1 && mobile !== undefined && mobile !== null
|
|
49
53
|
),
|
|
50
54
|
maxlength: mobileLength,
|
package/src/types/myth-api.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { AxiosInstance } from 'axios'
|
|
|
2
2
|
import type { HelpersStubSchema } from './api-helpers'
|
|
3
3
|
import type { ThemeContext } from './theme'
|
|
4
4
|
import type { MythComponentsProps } from './plugin-props-option'
|
|
5
|
+
import type { MInputProps } from './components'
|
|
5
6
|
|
|
6
7
|
export interface ApiContext {
|
|
7
8
|
url: string;
|
|
@@ -38,5 +39,5 @@ export interface MythApi {
|
|
|
38
39
|
* Default is true.
|
|
39
40
|
* The Length must be 10.
|
|
40
41
|
*/
|
|
41
|
-
mobileRule?:
|
|
42
|
+
mobileRule?: MInputProps['mobile'];
|
|
42
43
|
}
|