File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 81
81
82
82
data () {
83
83
return {
84
- control: null
84
+ control: null ,
85
+ initial: true
85
86
}
86
87
},
87
88
105
106
if (this .accessToken ) this .mapbox .accessToken = this .accessToken
106
107
const Geocoder = this .mapboxGeocoder
107
108
this .control = new Geocoder (this ._props )
109
+ this .control .on (' results' , this .$_updateInput )
110
+ },
111
+
112
+ beforeDestroy () {
113
+ this .control .off (' results' , this .$_updateInput )
108
114
},
109
115
110
116
methods: {
124
130
this .$_bindSelfEvents (eventsToListen, this .control )
125
131
}
126
132
payload .component .$off (' load' , this .$_deferredMount )
133
+ this .initial = false
134
+ },
135
+
136
+ $_updateInput (results) {
137
+ if (! this .initial ) {
138
+ const input = results .query ? results .query .join (' ' ) : ' '
139
+ this .$emit (' update:input' , input)
140
+ }
127
141
},
128
142
129
143
query (query ) {
You can’t perform that action at this time.
0 commit comments