提交 27790c75 编写于 作者: Q qiang

fix(h5): 优化地图选点组件

上级 9813d0e9
......@@ -9,17 +9,17 @@
@regionchange="_regionchange"
>
<div class="map-location" />
<div
class="map-move"
@click="_moveToLocation"
<div
class="map-move"
@click="_moveToLocation"
>
<i>&#xec32;</i>
</div>
</v-uni-map>
<div class="nav">
<div
class="nav-btn back"
@click="_back"
<div
class="nav-btn back"
@click="_back"
>
<i class="uni-btn-icon">&#xe650;</i>
</div>
......@@ -51,14 +51,14 @@
取消
</div>
</div>
<v-uni-scroll-view
scroll-y
class="list"
@scrolltolower="_scrolltolower"
<v-uni-scroll-view
scroll-y
class="list"
@scrolltolower="_scrolltolower"
>
<div
v-if="loading"
class="list-loading"
<div
v-if="loading"
class="list-loading"
>
<i class="uni-loading" />
</div>
......@@ -67,7 +67,11 @@
:key="index"
class="list-item"
:class="{ selected: selectedIndex === index }"
@click="selectedIndex = index"
@click="
selectedIndex = index;
latitude = item.latitude;
longitude = item.longitude;
"
>
<div class="list-item-title">
{{ item.name }}
......@@ -117,12 +121,6 @@ export default {
this._getList()
}
}, 1000)
this.$watch(() => this.latitude + this.longitude, () => {
if (!this.searching) {
this._reset()
this._getList()
}
})
this.$watch('searching', val => {
this._reset()
if (!val) {
......@@ -147,21 +145,19 @@ export default {
_moveToLocation () {
uni.getLocation({
type: 'gcj02',
success: ({ latitude, longitude }) => {
this.latitude = latitude
this.longitude = longitude
},
success: this._move.bind(this),
fail: () => {
this.latitude = 39.90960456049752
this.longitude = 116.3972282409668
this._move({
latitude: 39.90960456049752,
longitude: 116.3972282409668
})
}
})
},
_regionchange ({ detail: { centerLocation } }) {
if (centerLocation) {
// TODO 图钉 icon 动画
this.latitude = centerLocation.latitude
this.longitude = centerLocation.longitude
this._move(centerLocation)
}
},
_pushData (array) {
......@@ -203,6 +199,14 @@ export default {
this.pageIndex = 1
this.list = []
},
_move ({ latitude, longitude }) {
this.latitude = latitude
this.longitude = longitude
if (!this.searching) {
this._reset()
this._getList()
}
},
_input () {
this._search()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册