1
- import { ref , watch , computed , nextTick , reactive , PropType } from 'vue' ;
1
+ import {
2
+ ref ,
3
+ watch ,
4
+ computed ,
5
+ nextTick ,
6
+ reactive ,
7
+ PropType ,
8
+ defineComponent ,
9
+ } from 'vue' ;
2
10
3
11
// Utils
4
12
import { ComponentInstance , createNamespace , isObject } from '../utils' ;
@@ -16,11 +24,11 @@ import Toast from '../toast';
16
24
import Button from '../button' ;
17
25
import Dialog from '../dialog' ;
18
26
import Switch from '../switch' ;
19
- import Detail , { AddressEditSearchItem } from './Detail ' ;
27
+ import AddressEditDetail , { AddressEditSearchItem } from './AddressEditDetail ' ;
20
28
21
- const [ createComponent , bem , t ] = createNamespace ( 'address-edit' ) ;
29
+ const [ name , bem , t ] = createNamespace ( 'address-edit' ) ;
22
30
23
- export type AddressInfo = {
31
+ export type AddressEditInfo = {
24
32
tel : string ;
25
33
name : string ;
26
34
city : string ;
@@ -33,7 +41,7 @@ export type AddressInfo = {
33
41
addressDetail : string ;
34
42
} ;
35
43
36
- const defaultData : AddressInfo = {
44
+ const defaultData : AddressEditInfo = {
37
45
name : '' ,
38
46
tel : '' ,
39
47
city : '' ,
@@ -50,7 +58,9 @@ function isPostal(value: string) {
50
58
return / ^ \d { 6 } $ / . test ( value ) ;
51
59
}
52
60
53
- export default createComponent ( {
61
+ export default defineComponent ( {
62
+ name,
63
+
54
64
props : {
55
65
areaList : Object as PropType < AreaList > ,
56
66
isSaving : Boolean ,
@@ -85,7 +95,7 @@ export default createComponent({
85
95
default : 200 ,
86
96
} ,
87
97
addressInfo : {
88
- type : Object as PropType < Partial < AddressInfo > > ,
98
+ type : Object as PropType < Partial < AddressEditInfo > > ,
89
99
default : ( ) => ( { ...defaultData } ) ,
90
100
} ,
91
101
telValidator : {
@@ -118,7 +128,7 @@ export default createComponent({
118
128
const areaRef = ref < ComponentInstance > ( ) ;
119
129
120
130
const state = reactive ( {
121
- data : { } as AddressInfo ,
131
+ data : { } as AddressEditInfo ,
122
132
showAreaPopup : false ,
123
133
detailFocused : false ,
124
134
errorInfo : {
@@ -359,7 +369,7 @@ export default createComponent({
359
369
state . showAreaPopup = ! disableArea ;
360
370
} }
361
371
/>
362
- < Detail
372
+ < AddressEditDetail
363
373
show = { props . showDetail }
364
374
value = { data . addressDetail }
365
375
focused = { state . detailFocused }
0 commit comments