提交 83d1113e authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 3bd03663
......@@ -13,7 +13,7 @@
<el-input v-model="ruleForm.shop_tel" maxlength="11" v-else></el-input>
</el-form-item>
<el-form-item label="详细地址" prop="shop_address">
<el-input v-model="ruleForm.shop_address">
<el-input v-model="ruleForm.shop_address" @keyup.enter.native="mapSearch">
<template #append>
<el-button @click="mapSearch">搜索地图</el-button>
</template>
......@@ -108,7 +108,12 @@ export default {
if (this.map) {
return
}
const position = JSON.parse(this.ruleForm.shop_pos)
let position = null
try {
position = JSON.parse(this.ruleForm.shop_pos)
} catch (error) {
console.log('解析错误')
}
this.map = new window.AMap.Map('map-container', {
resizeEnable: true,
zoom: 16,
......@@ -126,6 +131,7 @@ export default {
window.AMap.plugin(['AMap.PlaceSearch'], () => {
// 构造地点查询类
this.placeSearch = new window.AMap.PlaceSearch({
city: '北京',
pageSize: 5, // 单页显示结果条数
pageIndex: 1, // 页码
map: this.map, // 展现结果的地图实例
......@@ -136,7 +142,6 @@ export default {
const data = e.selected.data
this.ruleForm.shop_address = data.cityname + data.adname + data.name
this.ruleForm.shop_pos = JSON.stringify([data.location.lng, data.location.lat])
console.log(data)
})
})
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论