Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

驾车路线规划增加支持起始点拖动 #1013

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions components/search/Driving.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export default {
},
selectFirstResult: {
type: Boolean
},
dragging: {
type: Boolean,
default: false
}
},
watch: {
Expand Down Expand Up @@ -135,7 +139,7 @@ export default {
},
load () {
const instance = this
const {map, BMap, location, policy, selectFirstResult, autoViewport, highlightMode, search, start, end, startCity, endCity, waypoints, originInstance, getWaypoints} = this
const {map, BMap, location, policy, selectFirstResult, autoViewport, highlightMode, search, start, end, startCity, endCity, waypoints, originInstance, getWaypoints, dragging} = this
const _location = location ? isPoint(location) ? createPoint(BMap, location) : location : map
const route = this.originInstance = new BMap.DrivingRoute(_location, {
renderOptions: {
Expand All @@ -144,7 +148,8 @@ export default {
panel: this.$el,
selectFirstResult,
autoViewport,
highlightMode
highlightMode,
enableDragging: dragging
},
policy: global[policy],
onSearchComplete (e) {
Expand Down
7 changes: 5 additions & 2 deletions docs/md/zh/bm-driving.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
|panel|Boolean|true|是否选展现检索结果面板。|
|autoViewport|Boolean||检索结束后是否自动调整地图视野。|
|selectFirstResult|Boolean||是否选择第一个检索结果。|
|dragging|Boolean||是否支持起终点支持拖动|

## 事件

Expand Down Expand Up @@ -47,7 +48,8 @@
startCity="北京"
endCity="南京"
:auto-viewport="true"
:waypoints="['呼和浩特', {lng: 112.53, lat: 37.87}, '陕西兵马俑']"></bm-driving>
:waypoints="['呼和浩特', {lng: 112.53, lat: 37.87}, '陕西兵马俑']"
:dragging="true"></bm-driving>
</baidu-map>
</template>
```
Expand All @@ -64,7 +66,8 @@
startCity="北京"
endCity="南京"
:auto-viewport="true"
:waypoints="['呼和浩特', {lng: 112.53, lat: 37.87}, '陕西兵马俑']"></bm-driving>
:waypoints="['呼和浩特', {lng: 112.53, lat: 37.87}, '陕西兵马俑']"
:dragging="true"></bm-driving>
</baidu-map>
</doc-preview>

Expand Down
4 changes: 4 additions & 0 deletions types/driving.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ export declare class Driving extends BaiduMapComponent {
* 是否选择第一个检索结果。
*/
selectFirstResult: boolean
/**
* 是否支持起终点支持拖动。
*/
dragging: boolean
}