监听如果切换了门店,则刷新列表

This commit is contained in:
wangxiaowei
2025-12-26 22:19:34 +08:00
parent ff6724d338
commit 027ca5f82c

View File

@ -70,11 +70,19 @@
const list = ref<Array<any>>([]) // 茶艺师列表 const list = ref<Array<any>>([]) // 茶艺师列表
const keywords = ref<string>('') const keywords = ref<string>('')
const orderStatus = ref<string>('') const orderStatus = ref<string>('')
// const canReset = ref<boolean>(false) // 避免onShow重复加载
// tab // tab
const tab = ref<string>('all') const tab = ref<string>('all')
// onShow(() => {
// if (canReset.value) {
// list.value = []
// getMescroll().resetUpScroll();
// }
// canReset.value = true
// })
onLoad((args) => { onLoad((args) => {
uni.$on('refreshOrderList', () => { uni.$on('refreshOrderList', () => {
list.value = [] list.value = []
@ -158,6 +166,20 @@
}, },
} }
/**
* 监听默认店铺变化,刷新列表
*/
watch(
() => useStore.defaultStore.id,
(newId, oldId) => {
if (newId !== oldId) {
// 这里写刷新逻辑,比如重置列表并重新请求
list.value = []
getMescroll().resetUpScroll()
}
}
)
</script> </script>
<style lang="scss"> <style lang="scss">