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 8181
8282 data () {
8383 return {
84- control: null
84+ control: null ,
85+ initial: true
8586 }
8687 },
8788
105106 if (this .accessToken ) this .mapbox .accessToken = this .accessToken
106107 const Geocoder = this .mapboxGeocoder
107108 this .control = new Geocoder (this ._props )
109+ this .control .on (' results' , this .$_updateInput )
110+ },
111+
112+ beforeDestroy () {
113+ this .control .off (' results' , this .$_updateInput )
108114 },
109115
110116 methods: {
124130 this .$_bindSelfEvents (eventsToListen, this .control )
125131 }
126132 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+ }
127141 },
128142
129143 query (query ) {
You can’t perform that action at this time.
0 commit comments