16
16
</div >
17
17
</slot >
18
18
</div >
19
-
20
19
<div class =" pac-input-container" >
21
- <slot name =" before-input" ></ slot >
22
- <input ref =" input" type =" text" :value = " model " @input =" onInputChange" :placeholder =" placeholder" >
23
- <slot name =" after-input" ></ slot >
20
+ <slot name =" before-input" / >
21
+ <input ref =" input" type =" text" v-model = " autocompleteModel " @input =" onInputChange" :placeholder =" placeholder" >
22
+ <slot name =" after-input" / >
24
23
</div >
25
24
</div >
26
25
</template >
@@ -47,8 +46,8 @@ export default {
47
46
FindElement,
48
47
Ready
49
48
],
50
-
51
49
props: {
50
+ value: null ,
52
51
model: String ,
53
52
placeholder: {
54
53
type: String ,
@@ -67,13 +66,21 @@ export default {
67
66
default: true
68
67
}
69
68
},
70
-
69
+ computed: {
70
+ autocompleteModel: {
71
+ get () {
72
+ return this .value
73
+ },
74
+ set (value) {
75
+ this .$emit (' input' , value)
76
+ }
77
+ }
78
+ },
71
79
data () {
72
80
return {
73
81
localTypes: this .$props .types
74
82
}
75
83
},
76
-
77
84
methods: {
78
85
... redirectMethods ({
79
86
target () {
@@ -85,12 +92,10 @@ export default {
85
92
this .$emit (' update:model' , event .target .value )
86
93
}
87
94
},
88
-
89
95
watch: {
90
96
localTypes: ' setTypes' ,
91
97
types: ' setTypes'
92
98
},
93
-
94
99
created () {
95
100
const mapAncestor = this .$_findAncestor (
96
101
a => a .$options .name === ' GoogleMap'
@@ -100,12 +105,10 @@ export default {
100
105
}
101
106
this .$_mapAncestor = mapAncestor
102
107
},
103
-
104
108
async googleMapsPrepare () {
105
109
const mapComp = this .$_mapAncestor
106
110
this .$_map = mapComp ? await mapComp .$_getMap () : null
107
111
},
108
-
109
112
googleMapsReady () {
110
113
this .$_autocomplete = new window.google.maps.places.Autocomplete (this .$refs .input )
111
114
this .$_autocomplete .setTypes (this .$props .types )
0 commit comments