组件的使用请参考vue+ElementUI+高德API地址模糊搜索(自定义UI组件) - Lena_叶 - 博客园
这里对收起后添加了一个展开功能的优化处理
1.在收起按钮后新增一个展开按钮,显示条件如下:
并把收起的点击事件修改为以下方法
<div>
<el-button
v-show="snameMapShow"
type="text"
size="mini"
@click="showMap"
>收起<i class="el-icon-caret-top"></i
></el-button>
</div>
<div>
<el-button
v-show="
snameMapShow == false &&
editForm.slat !== 0 &&
btnMapShow == true
"
type="text"
size="mini"
@click.stop="snameMapShow = true"
>展开<i class="el-icon-caret-bottom"></i
></el-button>
</div>
2.在data中新增
3.点击收起时显示展开并隐藏地图
showMap() {
this.snameMapShow = false;
this.btnMapShow = true;
},
4.编辑时的方法把btnMapshow设置为false
// 编辑信息
edit(row) {
this.dialogItem.title = "编辑厂区信息";
this.editForm.createTime = row.createTime;
this.editForm.siteNum = row.siteNum;
this.editForm.siteName = row.siteName;
this.editForm.id = row.id;
this.editForm.sname = row.siteAddress;
this.editForm.slon = row.longitude;
this.editForm.slat = row.latitude;
this.editForm.remark = row.remark;
this.btnMapShow = false;
this.$refs.mdgDialog.importDialogShown = true;
},
5.新增厂区时要将数据和按钮都复原
// 新增厂区
addFactor() {
this.editForm = {
id: "",
siteNum: "",
siteName: "",
sname: "",
slat: 0,
slon: 0,
remark: ""
};
this.snameMapShow = false;
this.btnMapShow = true;
this.$refs.mdgDialog.importDialogShown = true;
},
最后
以上就是忧郁学姐最近收集整理的关于可搜索+拖动的高德地图组件的全部内容,更多相关可搜索+拖动内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复