移除本地生活商品返回上一页刷新页面的问题

This commit is contained in:
wangxiaowei 2024-12-02 17:38:42 +08:00
parent 84ac4f467e
commit 60d6528485
2 changed files with 17 additions and 9 deletions

@ -432,9 +432,9 @@
}); });
} }
}, },
onUnload() { // onUnload() {
uni.$emit('refresh_local_shop_list', true) // uni.$emit('refresh_local_shop_list', true)
}, // },
computed: { computed: {
btnText() { btnText() {
if (this.state == 1) { if (this.state == 1) {

@ -2,7 +2,8 @@
<view> <view>
<tabs :current="active" @change="changeShow" bar-width="60" :is-scroll="false" :num="20"> <tabs :current="active" @change="changeShow" bar-width="60" :is-scroll="false" :num="20">
<tab v-for="(item, index) in menu" :key="index" :name="item.name" :num="item.num"> <tab v-for="(item, index) in menu" :key="index" :name="item.name" :num="item.num">
<shop-list :order-type="item.type" :lstore-id="lstore_id" :i="index" :index="active" @setGoodsStateNum="setGoodsStateNum"></shop-list> <shop-list :order-type="item.type" :lstore-id="lstore_id" :scroll-to="scrollTo" :i="index" :index="active"
@setGoodsStateNum="setGoodsStateNum"></shop-list>
</tab> </tab>
</tabs> </tabs>
</view> </view>
@ -12,7 +13,7 @@
import shopList from './components/shop-list.vue' import shopList from './components/shop-list.vue'
export default { export default {
components: { components: {
shopList, shopList,
}, },
data() { data() {
return { return {
@ -34,16 +35,24 @@
type: 4, type: 4,
num: 0 num: 0
}], }],
lstore_id: 0 lstore_id: 0,
scrollTo: 0
}; };
}, },
onLoad(options) { onLoad(options) {
this.lstore_id = options?.lstore_id this.lstore_id = options?.lstore_id
this.changeShow(0); this.changeShow(0);
}, },
onShow() {
if (uni.getStorageSync('mescrollScrollTop')) {
this.scrollTo = uni.getStorageSync('mescrollScrollTop')
console.log('getStorageSync=', uni.getStorageSync('mescrollScrollTop'))
}
},
methods: { methods: {
changeShow(index) { changeShow(index) {
if(index != -1) { if (index != -1) {
this.$nextTick(() => { this.$nextTick(() => {
this.active = index this.active = index
}) })
@ -57,7 +66,6 @@
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
</style> </style>