File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ Now you can add geocoder control like other controls:
2323 <MglGeocoderControl
2424 :accessToken =" accessToken"
2525 :input.sync =" defaultInput"
26+ container =" geocoder_container_id"
27+ position =" top-left"
2628 @results =" handleSearch"
2729 />
2830 </MglMap >
Original file line number Diff line number Diff line change @@ -16,6 +16,14 @@ export default {
1616 inject : [ 'mapbox' , 'map' ] ,
1717
1818 props : {
19+ position : {
20+ type : String ,
21+ default : 'top-right' ,
22+ } ,
23+ container : {
24+ type : String ,
25+ default : null ,
26+ } ,
1927 // Mapbox-geocoder options
2028 accessToken : {
2129 type : String ,
@@ -123,7 +131,13 @@ export default {
123131
124132 methods : {
125133 $_deferredMount ( ) {
126- this . map . addControl ( this . control ) ;
134+ if ( this . container !== null ) {
135+ document
136+ . getElementById ( this . container )
137+ . appendChild ( this . control . onAdd ( this . map ) ) ;
138+ } else {
139+ this . map . addControl ( this . control , this . position ) ;
140+ }
127141 if ( this . input ) {
128142 this . control . setInput ( this . input ) ;
129143 }
You can’t perform that action at this time.
0 commit comments