mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-26 19:36:36 +08:00
types(ContactEdit): use tsx (#8145)
* types(ContactEdit): use tsx * types: improve
This commit is contained in:
parent
cb2c2b9b68
commit
4f4e0b4f94
@ -1,4 +1,4 @@
|
|||||||
import { watch, reactive } from 'vue';
|
import { watch, reactive, PropType } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace } from '../utils';
|
import { createNamespace } from '../utils';
|
||||||
@ -14,7 +14,13 @@ import Switch from '../switch';
|
|||||||
|
|
||||||
const [createComponent, bem, t] = createNamespace('contact-edit');
|
const [createComponent, bem, t] = createNamespace('contact-edit');
|
||||||
|
|
||||||
const DEFAULT_CONTACT = {
|
export type ContactInfo = {
|
||||||
|
tel: string;
|
||||||
|
name: string;
|
||||||
|
isDefault?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
const DEFAULT_CONTACT: ContactInfo = {
|
||||||
tel: '',
|
tel: '',
|
||||||
name: '',
|
name: '',
|
||||||
};
|
};
|
||||||
@ -27,11 +33,11 @@ export default createComponent({
|
|||||||
showSetDefault: Boolean,
|
showSetDefault: Boolean,
|
||||||
setDefaultLabel: String,
|
setDefaultLabel: String,
|
||||||
contactInfo: {
|
contactInfo: {
|
||||||
type: Object,
|
type: Object as PropType<ContactInfo>,
|
||||||
default: () => ({ ...DEFAULT_CONTACT }),
|
default: () => ({ ...DEFAULT_CONTACT }),
|
||||||
},
|
},
|
||||||
telValidator: {
|
telValidator: {
|
||||||
type: Function,
|
type: Function as PropType<(val: string) => boolean>,
|
||||||
default: isMobile,
|
default: isMobile,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -84,8 +90,8 @@ export default createComponent({
|
|||||||
<Switch
|
<Switch
|
||||||
v-model={contact.isDefault}
|
v-model={contact.isDefault}
|
||||||
size={24}
|
size={24}
|
||||||
onChange={(event) => {
|
onChange={(checked: boolean) => {
|
||||||
emit('change-default', event);
|
emit('change-default', checked);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
Loading…
x
Reference in New Issue
Block a user