pass_b_map_vue2 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +22 -0
- package/.github/ISSUE_TEMPLATE.md +7 -0
- package/.travis.yml +26 -0
- package/CONTRIBUTING.md +27 -0
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/build/compiler.js +127 -0
- package/build/webpack.docs.config.js +86 -0
- package/build/webpack.prod.config.js +24 -0
- package/build/webpack.test.config.js +27 -0
- package/components/base/bindEvent.js +11 -0
- package/components/base/events.js +120 -0
- package/components/base/factory.js +39 -0
- package/components/base/mixins/abstract.js +13 -0
- package/components/base/mixins/common.js +81 -0
- package/components/base/util.js +6 -0
- package/components/context-menu/Item.vue +62 -0
- package/components/context-menu/Menu.vue +52 -0
- package/components/controls/CityList.vue +43 -0
- package/components/controls/Control.vue +37 -0
- package/components/controls/Copyright.vue +52 -0
- package/components/controls/Geolocation.vue +59 -0
- package/components/controls/MapType.vue +39 -0
- package/components/controls/Navigation.vue +55 -0
- package/components/controls/OverviewMap.vue +56 -0
- package/components/controls/Panorama.vue +29 -0
- package/components/controls/Scale.vue +36 -0
- package/components/extra/CurveLine.vue +101 -0
- package/components/extra/Heatmap.vue +78 -0
- package/components/extra/Lushu.vue +125 -0
- package/components/extra/MarkerClusterer.vue +93 -0
- package/components/index.js +98 -0
- package/components/layers/Tile.vue +53 -0
- package/components/layers/Traffic.vue +34 -0
- package/components/map/Map.vue +287 -0
- package/components/map/MapView.vue +9 -0
- package/components/others/AutoComplete.vue +70 -0
- package/components/others/Boundary.vue +60 -0
- package/components/overlays/Circle.vue +170 -0
- package/components/overlays/Ground.vue +65 -0
- package/components/overlays/Icon.vue +0 -0
- package/components/overlays/InfoWindow.vue +137 -0
- package/components/overlays/Label.vue +99 -0
- package/components/overlays/Marker.vue +163 -0
- package/components/overlays/Overlay.vue +55 -0
- package/components/overlays/PointCollection.vue +76 -0
- package/components/overlays/Polygon.vue +105 -0
- package/components/overlays/Polyline.vue +86 -0
- package/components/overlays/Symblo.vue +0 -0
- package/components/search/Bus.vue +102 -0
- package/components/search/Driving.vue +177 -0
- package/components/search/LocalSearch.vue +152 -0
- package/components/search/Transit.vue +126 -0
- package/components/search/Walking.vue +115 -0
- package/index.d.ts +3 -0
- package/index.js +1 -0
- package/karma.conf.js +44 -0
- package/package.json +69 -0
- package/test/map.js +37 -0
- package/test/util/BMap.mock/Map.js +82 -0
- package/test/util/BMap.mock/create-class.js +9 -0
- package/test/util/BMap.mock/index.js +5 -0
- package/test/util/BMap.mock/spy.js +2 -0
- package/test/util/util.js +12 -0
- package/types/auto-complete.d.ts +21 -0
- package/types/base/base-control.d.ts +12 -0
- package/types/base/common.d.ts +127 -0
- package/types/boundary.d.ts +40 -0
- package/types/bus.d.ts +27 -0
- package/types/circle.d.ts +46 -0
- package/types/city-list.d.ts +3 -0
- package/types/control.d.ts +3 -0
- package/types/copyright.d.ts +7 -0
- package/types/curve-line.d.ts +36 -0
- package/types/driving.d.ts +47 -0
- package/types/geolocation.d.ts +18 -0
- package/types/ground.d.ts +24 -0
- package/types/heatmap.d.ts +29 -0
- package/types/index.d.ts +93 -0
- package/types/info-window.d.ts +51 -0
- package/types/item.d.ts +25 -0
- package/types/label.d.ts +35 -0
- package/types/local-search.d.ts +62 -0
- package/types/lushu.d.ts +53 -0
- package/types/map-type.d.ts +13 -0
- package/types/map-view.d.ts +3 -0
- package/types/map.d.ts +87 -0
- package/types/marker-clusterer.d.ts +25 -0
- package/types/marker.d.ts +78 -0
- package/types/menu.d.ts +7 -0
- package/types/navigation.d.ts +18 -0
- package/types/overlay.d.ts +16 -0
- package/types/overview-map.d.ts +14 -0
- package/types/panorama.d.ts +3 -0
- package/types/point-collection.d.ts +26 -0
- package/types/polygon.d.ts +46 -0
- package/types/polyline.d.ts +37 -0
- package/types/scale.d.ts +3 -0
- package/types/tile.d.ts +21 -0
- package/types/traffic.d.ts +8 -0
- package/types/transit.d.ts +39 -0
- package/types/tsconfig.json +17 -0
- package/types/walking.d.ts +35 -0
|
File without changes
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="panel">
|
|
3
|
+
</div>
|
|
4
|
+
</template>
|
|
5
|
+
|
|
6
|
+
<script>
|
|
7
|
+
import {createPoint} from '../base/factory.js'
|
|
8
|
+
import {isPoint} from '../base/util.js'
|
|
9
|
+
import commonMixin from '../base/mixins/common.js'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: 'bm-bus',
|
|
13
|
+
mixins: [commonMixin('search')],
|
|
14
|
+
props: {
|
|
15
|
+
location: {
|
|
16
|
+
type: [Object, String]
|
|
17
|
+
},
|
|
18
|
+
keyword: {
|
|
19
|
+
type: String
|
|
20
|
+
},
|
|
21
|
+
panel: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
24
|
+
},
|
|
25
|
+
pageCapacity: {
|
|
26
|
+
type: Number
|
|
27
|
+
},
|
|
28
|
+
autoViewport: {
|
|
29
|
+
type: Boolean
|
|
30
|
+
},
|
|
31
|
+
selectFirstResult: {
|
|
32
|
+
type: Boolean
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
watch: {
|
|
36
|
+
location: {
|
|
37
|
+
handler (val) {
|
|
38
|
+
const {originInstance, map} = this
|
|
39
|
+
originInstance.setLocation(val || map)
|
|
40
|
+
},
|
|
41
|
+
deep: true
|
|
42
|
+
},
|
|
43
|
+
keyword (val) {
|
|
44
|
+
this.search(val)
|
|
45
|
+
},
|
|
46
|
+
panel () {
|
|
47
|
+
this.reload()
|
|
48
|
+
},
|
|
49
|
+
autoViewport (val) {
|
|
50
|
+
this.reload()
|
|
51
|
+
},
|
|
52
|
+
selectFirstResult (val) {
|
|
53
|
+
this.reload()
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
search (keyword) {
|
|
58
|
+
const {originInstance} = this
|
|
59
|
+
originInstance.getBusList(keyword)
|
|
60
|
+
},
|
|
61
|
+
load () {
|
|
62
|
+
const instance = this
|
|
63
|
+
const {location, selectFirstResult, autoViewport, highlightMode, keyword, search, BMap, map, originInstance} = this
|
|
64
|
+
const _location = location ? isPoint(location) ? createPoint(BMap, location) : location : map
|
|
65
|
+
const route = this.originInstance = new BMap.BusLineSearch(_location, {
|
|
66
|
+
renderOptions: {
|
|
67
|
+
map,
|
|
68
|
+
panel: this.$el,
|
|
69
|
+
selectFirstResult,
|
|
70
|
+
autoViewport,
|
|
71
|
+
highlightMode
|
|
72
|
+
},
|
|
73
|
+
onGetBusListComplete (e) {
|
|
74
|
+
if (originInstance && originInstance !== route) {
|
|
75
|
+
originInstance.clearResults()
|
|
76
|
+
}
|
|
77
|
+
instance.$emit('getbuslistcomplete', e)
|
|
78
|
+
},
|
|
79
|
+
onGetBusLineComplete (e) {
|
|
80
|
+
if (originInstance && originInstance !== route) {
|
|
81
|
+
originInstance.clearResults()
|
|
82
|
+
}
|
|
83
|
+
instance.$emit('getbuslinecomplete', e)
|
|
84
|
+
},
|
|
85
|
+
onBusListHtmlSet (e) {
|
|
86
|
+
instance.$emit('buslisthtmlset', e)
|
|
87
|
+
},
|
|
88
|
+
onBusLineHtmlSet (e) {
|
|
89
|
+
instance.$emit('buslinehtmlset', e)
|
|
90
|
+
},
|
|
91
|
+
onMarkersSet (e) {
|
|
92
|
+
instance.$emit('markersset', e)
|
|
93
|
+
},
|
|
94
|
+
onPolylinesSet (e) {
|
|
95
|
+
instance.$emit('polylinesset', e)
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
search(keyword)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="panel">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import {createPoint} from '../base/factory.js'
|
|
9
|
+
import {isPoint, getPosition} from '../base/util.js'
|
|
10
|
+
import commonMixin from '../base/mixins/common.js'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'bm-driving',
|
|
14
|
+
mixins: [commonMixin('search')],
|
|
15
|
+
props: {
|
|
16
|
+
location: {
|
|
17
|
+
type: [Object, String]
|
|
18
|
+
},
|
|
19
|
+
start: {
|
|
20
|
+
type: [Object, String]
|
|
21
|
+
},
|
|
22
|
+
end: {
|
|
23
|
+
type: [Object, String]
|
|
24
|
+
},
|
|
25
|
+
startCity: {
|
|
26
|
+
type: [String, Number]
|
|
27
|
+
},
|
|
28
|
+
endCity: {
|
|
29
|
+
type: [String, Number]
|
|
30
|
+
},
|
|
31
|
+
waypoints: {
|
|
32
|
+
type: Array
|
|
33
|
+
},
|
|
34
|
+
policy: {
|
|
35
|
+
type: String
|
|
36
|
+
},
|
|
37
|
+
panel: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: true
|
|
40
|
+
},
|
|
41
|
+
autoViewport: {
|
|
42
|
+
type: Boolean
|
|
43
|
+
},
|
|
44
|
+
selectFirstResult: {
|
|
45
|
+
type: Boolean
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
watch: {
|
|
49
|
+
location: {
|
|
50
|
+
handler (val) {
|
|
51
|
+
const {originInstance, map} = this
|
|
52
|
+
originInstance.setLocation(val || map)
|
|
53
|
+
},
|
|
54
|
+
deep: true
|
|
55
|
+
},
|
|
56
|
+
start: {
|
|
57
|
+
handler (val) {
|
|
58
|
+
const {originInstance, end, startCity, endCity, waypoints, BMap, getWaypoints} = this
|
|
59
|
+
originInstance.search(getPosition(BMap, val), getPosition(BMap, end), {
|
|
60
|
+
startCity,
|
|
61
|
+
endCity,
|
|
62
|
+
waypoints: getWaypoints(waypoints)
|
|
63
|
+
})
|
|
64
|
+
},
|
|
65
|
+
deep: true
|
|
66
|
+
},
|
|
67
|
+
end: {
|
|
68
|
+
handler (val) {
|
|
69
|
+
const {originInstance, start, startCity, endCity, waypoints, BMap, getWaypoints} = this
|
|
70
|
+
originInstance.search(getPosition(BMap, start), getPosition(BMap, val), {
|
|
71
|
+
startCity,
|
|
72
|
+
endCity,
|
|
73
|
+
waypoints: getWaypoints(waypoints)
|
|
74
|
+
})
|
|
75
|
+
},
|
|
76
|
+
deep: true
|
|
77
|
+
},
|
|
78
|
+
startCity (val) {
|
|
79
|
+
const {originInstance, start, end, endCity, waypoints, getWaypoints} = this
|
|
80
|
+
originInstance.search(start, end, {
|
|
81
|
+
val,
|
|
82
|
+
endCity,
|
|
83
|
+
waypoints: getWaypoints(waypoints)
|
|
84
|
+
})
|
|
85
|
+
},
|
|
86
|
+
endCity (val) {
|
|
87
|
+
const {originInstance, start, end, startCity, waypoints, getWaypoints} = this
|
|
88
|
+
originInstance.search(start, end, {
|
|
89
|
+
startCity,
|
|
90
|
+
val,
|
|
91
|
+
waypoints: getWaypoints(waypoints)
|
|
92
|
+
})
|
|
93
|
+
},
|
|
94
|
+
waypoints: {
|
|
95
|
+
handler (val) {
|
|
96
|
+
const {originInstance, start, end, startCity, endCity, getWaypoints} = this
|
|
97
|
+
originInstance.search(start, end, {
|
|
98
|
+
startCity,
|
|
99
|
+
endCity,
|
|
100
|
+
waypoints: getWaypoints(val)
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
deep: true
|
|
104
|
+
},
|
|
105
|
+
panel () {
|
|
106
|
+
this.reload()
|
|
107
|
+
},
|
|
108
|
+
policy (val) {
|
|
109
|
+
this.reload()
|
|
110
|
+
},
|
|
111
|
+
autoViewport () {
|
|
112
|
+
this.reload()
|
|
113
|
+
},
|
|
114
|
+
selectFirstResult () {
|
|
115
|
+
this.reload()
|
|
116
|
+
},
|
|
117
|
+
highlightMode () {
|
|
118
|
+
this.reload()
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
methods: {
|
|
122
|
+
search (start, end, {startCity, endCity, waypoints}) {
|
|
123
|
+
const {originInstance, getWaypoints} = this
|
|
124
|
+
originInstance.search(start, end, {
|
|
125
|
+
startCity,
|
|
126
|
+
endCity,
|
|
127
|
+
waypoints: getWaypoints(waypoints)
|
|
128
|
+
})
|
|
129
|
+
},
|
|
130
|
+
getWaypoints (waypoints) {
|
|
131
|
+
const {BMap} = this
|
|
132
|
+
if (waypoints) {
|
|
133
|
+
return waypoints.map(position => getPosition(BMap, position))
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
load () {
|
|
137
|
+
const instance = this
|
|
138
|
+
const {map, BMap, location, policy, selectFirstResult, autoViewport, highlightMode, search, start, end, startCity, endCity, waypoints, originInstance, getWaypoints} = this
|
|
139
|
+
const _location = location ? isPoint(location) ? createPoint(BMap, location) : location : map
|
|
140
|
+
const route = this.originInstance = new BMap.DrivingRoute(_location, {
|
|
141
|
+
renderOptions: {
|
|
142
|
+
map,
|
|
143
|
+
// panel: panel && this.$el,
|
|
144
|
+
panel: this.$el,
|
|
145
|
+
selectFirstResult,
|
|
146
|
+
autoViewport,
|
|
147
|
+
highlightMode
|
|
148
|
+
},
|
|
149
|
+
policy: global[policy],
|
|
150
|
+
onSearchComplete (e) {
|
|
151
|
+
if (originInstance && originInstance !== route) {
|
|
152
|
+
originInstance.clearResults()
|
|
153
|
+
}
|
|
154
|
+
instance.$emit('searchcomplete', e)
|
|
155
|
+
},
|
|
156
|
+
onMarkersSet (e) {
|
|
157
|
+
instance.$emit('markersset', e)
|
|
158
|
+
},
|
|
159
|
+
onInfoHtmlSet (e) {
|
|
160
|
+
instance.$emit('infohtmlset', e)
|
|
161
|
+
},
|
|
162
|
+
onPolylinesSet (e) {
|
|
163
|
+
instance.$emit('polylinesset', e)
|
|
164
|
+
},
|
|
165
|
+
onResultsHtmlSet (e) {
|
|
166
|
+
instance.$emit('resultshtmlset', e)
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
search(getPosition(BMap, start), getPosition(BMap, end), {
|
|
170
|
+
startCity,
|
|
171
|
+
endCity,
|
|
172
|
+
waypoints: getWaypoints(waypoints)
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
</script>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="panel">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import {createPoint, createBounds} from '../base/factory.js'
|
|
9
|
+
import {isPoint} from '../base/util.js'
|
|
10
|
+
import commonMixin from '../base/mixins/common.js'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'bm-local-search',
|
|
14
|
+
mixins: [commonMixin('search')],
|
|
15
|
+
props: {
|
|
16
|
+
location: {
|
|
17
|
+
type: [Object, String]
|
|
18
|
+
},
|
|
19
|
+
keyword: {
|
|
20
|
+
type: [Array, String]
|
|
21
|
+
},
|
|
22
|
+
panel: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: true
|
|
25
|
+
},
|
|
26
|
+
forceLocal: {
|
|
27
|
+
type: Boolean
|
|
28
|
+
},
|
|
29
|
+
customData: {
|
|
30
|
+
type: Object
|
|
31
|
+
},
|
|
32
|
+
bounds: {
|
|
33
|
+
type: Object
|
|
34
|
+
},
|
|
35
|
+
nearby: {
|
|
36
|
+
type: Object
|
|
37
|
+
},
|
|
38
|
+
// page: {
|
|
39
|
+
// type: Number
|
|
40
|
+
// },
|
|
41
|
+
pageCapacity: {
|
|
42
|
+
type: Number
|
|
43
|
+
},
|
|
44
|
+
autoViewport: {
|
|
45
|
+
type: Boolean
|
|
46
|
+
},
|
|
47
|
+
selectFirstResult: {
|
|
48
|
+
type: Boolean
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
watch: {
|
|
52
|
+
location: {
|
|
53
|
+
handler (val) {
|
|
54
|
+
const {originInstance, search} = this
|
|
55
|
+
originInstance.setLocation(val || this.map)
|
|
56
|
+
search()
|
|
57
|
+
},
|
|
58
|
+
deep: true
|
|
59
|
+
},
|
|
60
|
+
keyword () {
|
|
61
|
+
this.search()
|
|
62
|
+
},
|
|
63
|
+
bounds: {
|
|
64
|
+
handler (val) {
|
|
65
|
+
const {searchInBounds} = this
|
|
66
|
+
searchInBounds(val)
|
|
67
|
+
},
|
|
68
|
+
deep: true
|
|
69
|
+
},
|
|
70
|
+
nearby: {
|
|
71
|
+
handler (val) {
|
|
72
|
+
const {searchNearby} = this
|
|
73
|
+
searchNearby(val)
|
|
74
|
+
},
|
|
75
|
+
deep: true
|
|
76
|
+
},
|
|
77
|
+
forceLocal () {
|
|
78
|
+
this.reload()
|
|
79
|
+
},
|
|
80
|
+
customData: {
|
|
81
|
+
deep: true,
|
|
82
|
+
handler () {
|
|
83
|
+
this.reload()
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// panel () {
|
|
87
|
+
// this.reload()
|
|
88
|
+
// },
|
|
89
|
+
pageCapacity (val) {
|
|
90
|
+
this.originInstance && this.originInstance.setPageCapacity(val)
|
|
91
|
+
},
|
|
92
|
+
autoViewport (val) {
|
|
93
|
+
this.originInstance && (val ? this.originInstance.enableAutoViewport() : this.originInstance.disableAutoViewport())
|
|
94
|
+
},
|
|
95
|
+
selectFirstResult (val) {
|
|
96
|
+
this.originInstance && (val ? this.originInstance.enableFirstResultSelection() : this.originInstance.disableFirstResultSelection())
|
|
97
|
+
},
|
|
98
|
+
highlightMode () {
|
|
99
|
+
this.reload()
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
methods: {
|
|
103
|
+
searchNearby (nearby) {
|
|
104
|
+
const {originInstance, keyword, customData, BMap} = this
|
|
105
|
+
originInstance.searchNearby(keyword, createPoint(BMap, nearby.center), nearby.radius, customData)
|
|
106
|
+
},
|
|
107
|
+
searchInBounds (bounds) {
|
|
108
|
+
const {originInstance, keyword, customData, BMap} = this
|
|
109
|
+
originInstance.searchInBounds(keyword, createBounds(BMap, bounds), customData)
|
|
110
|
+
},
|
|
111
|
+
search () {
|
|
112
|
+
const {originInstance, keyword, forceLocal, customData, nearby, bounds, searchNearby, searchInBounds} = this
|
|
113
|
+
nearby ? searchNearby(nearby) : bounds ? searchInBounds(bounds) : originInstance.search(keyword, {
|
|
114
|
+
forceLocal,
|
|
115
|
+
customData
|
|
116
|
+
})
|
|
117
|
+
},
|
|
118
|
+
load () {
|
|
119
|
+
const instance = this
|
|
120
|
+
const {map, BMap, search, pageCapacity, autoViewport, selectFirstResult, highlightMode, location, originInstance} = this
|
|
121
|
+
const _location = location ? isPoint(location) ? createPoint(BMap, location) : location : map
|
|
122
|
+
const route = this.originInstance = new BMap.LocalSearch(_location, {
|
|
123
|
+
onMarkersSet (e) {
|
|
124
|
+
instance.$emit('markersset', e)
|
|
125
|
+
},
|
|
126
|
+
onInfoHtmlSet (e) {
|
|
127
|
+
instance.$emit('infohtmlset', e)
|
|
128
|
+
},
|
|
129
|
+
onResultsHtmlSet (e) {
|
|
130
|
+
instance.$emit('resultshtmlset', e)
|
|
131
|
+
},
|
|
132
|
+
onSearchComplete (e) {
|
|
133
|
+
if (originInstance && originInstance !== route) {
|
|
134
|
+
originInstance.clearResults()
|
|
135
|
+
}
|
|
136
|
+
instance.$emit('searchcomplete', e)
|
|
137
|
+
},
|
|
138
|
+
pageCapacity: pageCapacity,
|
|
139
|
+
renderOptions: {
|
|
140
|
+
map,
|
|
141
|
+
// panel: panel && this.$el,
|
|
142
|
+
panel: this.$el,
|
|
143
|
+
selectFirstResult,
|
|
144
|
+
autoViewport,
|
|
145
|
+
highlightMode
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
search()
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
</script>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="panel">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import {createPoint} from '../base/factory.js'
|
|
9
|
+
import {isPoint, getPosition} from '../base/util.js'
|
|
10
|
+
import commonMixin from '../base/mixins/common.js'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'bm-transit',
|
|
14
|
+
mixins: [commonMixin('search')],
|
|
15
|
+
props: {
|
|
16
|
+
location: {
|
|
17
|
+
type: [Object, String]
|
|
18
|
+
},
|
|
19
|
+
start: {
|
|
20
|
+
type: [Object, String]
|
|
21
|
+
},
|
|
22
|
+
end: {
|
|
23
|
+
type: [Object, String]
|
|
24
|
+
},
|
|
25
|
+
panel: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
policy: {
|
|
30
|
+
type: String
|
|
31
|
+
},
|
|
32
|
+
pageCapacity: {
|
|
33
|
+
type: Number
|
|
34
|
+
},
|
|
35
|
+
autoViewport: {
|
|
36
|
+
type: Boolean
|
|
37
|
+
},
|
|
38
|
+
selectFirstResult: {
|
|
39
|
+
type: Boolean
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
watch: {
|
|
43
|
+
location: {
|
|
44
|
+
handler (val) {
|
|
45
|
+
const {originInstance, map} = this
|
|
46
|
+
originInstance.setLocation(val || map)
|
|
47
|
+
},
|
|
48
|
+
deep: true
|
|
49
|
+
},
|
|
50
|
+
start: {
|
|
51
|
+
handler (val) {
|
|
52
|
+
const {originInstance, end, BMap} = this
|
|
53
|
+
originInstance.search(getPosition(BMap, val), getPosition(BMap, end))
|
|
54
|
+
},
|
|
55
|
+
deep: true
|
|
56
|
+
},
|
|
57
|
+
end: {
|
|
58
|
+
handler (val) {
|
|
59
|
+
const {originInstance, start, BMap} = this
|
|
60
|
+
originInstance.search(getPosition(BMap, start), getPosition(BMap, val))
|
|
61
|
+
},
|
|
62
|
+
deep: true
|
|
63
|
+
},
|
|
64
|
+
panel () {
|
|
65
|
+
this.reload()
|
|
66
|
+
},
|
|
67
|
+
policy (val) {
|
|
68
|
+
this.originInstance.setPolicy(global[val])
|
|
69
|
+
},
|
|
70
|
+
pageCapacity (val) {
|
|
71
|
+
this.originInstance && this.originInstance.setPageCapacity(val)
|
|
72
|
+
},
|
|
73
|
+
autoViewport (val) {
|
|
74
|
+
this.originInstance && (val ? this.originInstance.enableAutoViewport() : this.originInstance.disableAutoViewport())
|
|
75
|
+
},
|
|
76
|
+
selectFirstResult () {
|
|
77
|
+
this.reload()
|
|
78
|
+
},
|
|
79
|
+
highlightMode () {
|
|
80
|
+
this.reload()
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
methods: {
|
|
84
|
+
search (start, end) {
|
|
85
|
+
const {originInstance} = this
|
|
86
|
+
originInstance.search(start, end)
|
|
87
|
+
},
|
|
88
|
+
load () {
|
|
89
|
+
const instance = this
|
|
90
|
+
const {map, BMap, location, policy, pageCapacity, selectFirstResult, autoViewport, highlightMode, search, start, end, originInstance} = this
|
|
91
|
+
const _location = location ? isPoint(location) ? createPoint(BMap, location) : location : map
|
|
92
|
+
const route = this.originInstance = new BMap.TransitRoute(_location, {
|
|
93
|
+
renderOptions: {
|
|
94
|
+
map,
|
|
95
|
+
// panel: panel && this.$el,
|
|
96
|
+
panel: this.$el,
|
|
97
|
+
selectFirstResult,
|
|
98
|
+
autoViewport,
|
|
99
|
+
highlightMode
|
|
100
|
+
},
|
|
101
|
+
policy: global[policy],
|
|
102
|
+
pageCapacity,
|
|
103
|
+
onSearchComplete (e) {
|
|
104
|
+
if (originInstance && originInstance !== route) {
|
|
105
|
+
originInstance.clearResults()
|
|
106
|
+
}
|
|
107
|
+
instance.$emit('searchcomplete', e)
|
|
108
|
+
},
|
|
109
|
+
onMarkersSet (e) {
|
|
110
|
+
instance.$emit('markersset', e)
|
|
111
|
+
},
|
|
112
|
+
onInfoHtmlSet (e) {
|
|
113
|
+
instance.$emit('infohtmlset', e)
|
|
114
|
+
},
|
|
115
|
+
onPolylinesSet (e) {
|
|
116
|
+
instance.$emit('polylinesset', e)
|
|
117
|
+
},
|
|
118
|
+
onResultsHtmlSet (e) {
|
|
119
|
+
instance.$emit('resultshtmlset', e)
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
search(isPoint(start) ? createPoint(BMap, start) : start, isPoint(end) ? createPoint(BMap, end) : end)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
</script>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="panel">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import {createPoint} from '../base/factory.js'
|
|
9
|
+
import {isPoint, getPosition} from '../base/util.js'
|
|
10
|
+
import commonMixin from '../base/mixins/common.js'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'bm-walking',
|
|
14
|
+
mixins: [commonMixin('search')],
|
|
15
|
+
props: {
|
|
16
|
+
location: {
|
|
17
|
+
type: [Object, String]
|
|
18
|
+
},
|
|
19
|
+
start: {
|
|
20
|
+
type: [Object, String]
|
|
21
|
+
},
|
|
22
|
+
end: {
|
|
23
|
+
type: [Object, String]
|
|
24
|
+
},
|
|
25
|
+
panel: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
pageCapacity: {
|
|
30
|
+
type: Number
|
|
31
|
+
},
|
|
32
|
+
autoViewport: {
|
|
33
|
+
type: Boolean
|
|
34
|
+
},
|
|
35
|
+
selectFirstResult: {
|
|
36
|
+
type: Boolean
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
watch: {
|
|
40
|
+
location: {
|
|
41
|
+
handler (val) {
|
|
42
|
+
const {originInstance, map} = this
|
|
43
|
+
originInstance.setLocation(val || map)
|
|
44
|
+
},
|
|
45
|
+
deep: true
|
|
46
|
+
},
|
|
47
|
+
start: {
|
|
48
|
+
handler (val) {
|
|
49
|
+
const {originInstance, end, BMap} = this
|
|
50
|
+
originInstance.search(getPosition(BMap, val), getPosition(BMap, end))
|
|
51
|
+
},
|
|
52
|
+
deep: true
|
|
53
|
+
},
|
|
54
|
+
end: {
|
|
55
|
+
handler (val) {
|
|
56
|
+
const {originInstance, start, BMap} = this
|
|
57
|
+
originInstance.search(getPosition(BMap, start), getPosition(BMap, val))
|
|
58
|
+
},
|
|
59
|
+
deep: true
|
|
60
|
+
},
|
|
61
|
+
panel () {
|
|
62
|
+
this.reload()
|
|
63
|
+
},
|
|
64
|
+
autoViewport (val) {
|
|
65
|
+
this.reload()
|
|
66
|
+
},
|
|
67
|
+
selectFirstResult (val) {
|
|
68
|
+
this.reload()
|
|
69
|
+
},
|
|
70
|
+
highlightMode () {
|
|
71
|
+
this.reload()
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
search (start, end) {
|
|
76
|
+
const {originInstance} = this
|
|
77
|
+
originInstance.search(start, end)
|
|
78
|
+
},
|
|
79
|
+
load () {
|
|
80
|
+
const instance = this
|
|
81
|
+
const {map, BMap, location, selectFirstResult, autoViewport, highlightMode, search, start, end, originInstance} = this
|
|
82
|
+
const _location = location ? isPoint(location) ? createPoint(BMap, location) : location : map
|
|
83
|
+
const route = this.originInstance = new BMap.WalkingRoute(_location, {
|
|
84
|
+
renderOptions: {
|
|
85
|
+
map,
|
|
86
|
+
// panel: panel && this.$el,
|
|
87
|
+
panel: this.$el,
|
|
88
|
+
selectFirstResult,
|
|
89
|
+
autoViewport,
|
|
90
|
+
highlightMode
|
|
91
|
+
},
|
|
92
|
+
onSearchComplete (e) {
|
|
93
|
+
if (originInstance && originInstance !== route) {
|
|
94
|
+
originInstance.clearResults()
|
|
95
|
+
}
|
|
96
|
+
instance.$emit('searchcomplete', e)
|
|
97
|
+
},
|
|
98
|
+
onMarkersSet (e) {
|
|
99
|
+
instance.$emit('markersset', e)
|
|
100
|
+
},
|
|
101
|
+
onInfoHtmlSet (e) {
|
|
102
|
+
instance.$emit('infohtmlset', e)
|
|
103
|
+
},
|
|
104
|
+
onPolylinesSet (e) {
|
|
105
|
+
instance.$emit('polylinesset', e)
|
|
106
|
+
},
|
|
107
|
+
onResultsHtmlSet (e) {
|
|
108
|
+
instance.$emit('resultshtmlset', e)
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
search(isPoint(start) ? createPoint(BMap, start) : start, isPoint(end) ? createPoint(BMap, end) : end)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
</script>
|
package/index.d.ts
ADDED