Fix:2416 【商城小程序】寻趣味进入店铺详情后返回,应停留在当前刷到的位置,现在每次返回都会刷新到页面顶部

This commit is contained in:
modendeveloper
2024-09-26 21:13:18 +08:00
parent e81aa3a490
commit 27d4727f89
+13 -2
View File
@@ -162,6 +162,7 @@ export default {
}, },
onShow() { onShow() {
const memCityName = uni.getStorageSync('cityName')
this.page = 1 this.page = 1
this.currType = {} this.currType = {}
this.typeIndex = 0 this.typeIndex = 0
@@ -171,13 +172,23 @@ export default {
this.currType = data[this.typeIndex] this.currType = data[this.typeIndex]
this.getMapData() this.getMapData()
}) })
const memCityName = uni.getStorageSync('cityName')
if (memCityName.length) { if (memCityName.length) {
this.cityName = memCityName this.cityName = memCityName
uni.removeStorageSync('cityName') uni.removeStorageSync('cityName')
this.name = '' this.name = ''
} }
}, },
watch: {
cityName: {
handler(value) {
if(value) {
this.search()
}
},
immediate: true,
deep: true
}
},
methods: { methods: {
goCity() { goCity() {
uni.navigateTo({ uni.navigateTo({
@@ -197,7 +208,7 @@ export default {
if(!this.cityName) { if(!this.cityName) {
this.cityName = address[1].data.result.ad_info.city this.cityName = address[1].data.result.ad_info.city
} }
this.search() // this.search()
} }
}, },
tapType(index) { tapType(index) {