Closed godkun closed 1 year ago
请填写使用版本: vue2版本
<template> <div class="amap-page-container"> <el-amap vid="amap" :zoom="zoom" :center="center" class="amap-demo"> <el-amap-polyline :editable="polyline.editable" :strokeColor="polyline.strokeColor" :strokeOpacity="polyline.strokeOpacity" :visible="polyline.visible" :strokeStyle="polyline.strokeStyle" :strokeWeight="polyline.strokeWeight" :draggable="polyline.draggable" :path="polyline.path" @click="click" ></el-amap-polyline> </el-amap> <div class="toolbar"> <button type="button" name="button" @click="toggleVisible">{{polyline.visible ? '隐藏标记' : '显示标记'}}</button> <button type="button" name="button" @click="changeDraggable">{{polyline.draggable ? '禁止标记移动' : '允许标记移动'}}</button> <button type="button" name="button" @click="changeEditable">{{polyline.editable ? '停止编辑' : '开始编辑'}}</button> </div> </div> </template> <style> .amap-demo { height: 300px; } </style> <script> module.exports = { data() { return { zoom: 12, center: [121.5273285, 31.25515044], polyline: { path: [[121.5389385, 31.21515044], [121.5389385, 31.29615044], [121.5273285, 31.21515044]], editable: true, visible: true, draggable: false, strokeWeight: 6, strokeStyle: 'solid', strokeOpacity: 1, strokeColor: '#000' } }; }, methods: { changeEditable() { this.polyline.editable = !this.polyline.editable; }, toggleVisible(){ this.polyline.visible = !this.polyline.visible; }, changeDraggable(){ this.polyline.draggable = !this.polyline.draggable; }, click(e) { alert('click polyline'); }, } }; </script>
如图:
在官方 https://docs.guyixi.cn/vue-amap/#/zh-cn/vector/polyline 文档中,对折线进行编辑,设置线条宽度等属性,不生效
编辑状态的折线样式是通过editOptins属性控制的,编辑是通过高德自己的折线编辑插件实现,所以需要额外的参数去配置
好滴,明白了,感谢~
使用版本
请填写使用版本: vue2版本
问题描述
如图:
在官方 https://docs.guyixi.cn/vue-amap/#/zh-cn/vector/polyline 文档中,对折线进行编辑,设置线条宽度等属性,不生效