修复:tab点击事件问题
This commit is contained in:
parent
7e928df849
commit
84fcab0ae6
@ -180,7 +180,7 @@ watch(
|
||||
<div v-for="item in categoryLayers[0]" class="app-tab-bar-item"
|
||||
:class="{ 'app-tab-bar-item-active': item.id === layerActiveValues[0] }" :key="item.id"
|
||||
:value="item.id"
|
||||
@click="layerActiveValues[0] = item.id">
|
||||
@click="menuStore.onCategorySelect(0, item.id)">
|
||||
{{ item.label }}
|
||||
</div>
|
||||
</div>
|
||||
@ -470,11 +470,10 @@ watch(
|
||||
display: flex;
|
||||
padding-left: 8px;
|
||||
flex: 1;
|
||||
cursor: default;
|
||||
cursor: pointer;
|
||||
|
||||
.app-tab-bar-item {
|
||||
padding: 0 8px;
|
||||
|
||||
}
|
||||
|
||||
.app-tab-bar-item-active {
|
||||
|
||||
@ -126,6 +126,9 @@ const menuStore = useMenuStore()
|
||||
const { categoryTree, layerActiveValues, categoryLayers } = storeToRefs(menuStore)
|
||||
const { filterVisible } = menuStore
|
||||
|
||||
/** 标记是否为分类初始化阶段,用于 watch 时区分初始加载与用户切换 */
|
||||
const isCategoryInitializing = ref(false)
|
||||
|
||||
|
||||
|
||||
function doSearch(keyword: string) {
|
||||
@ -257,7 +260,9 @@ async function loadCategory() {
|
||||
|
||||
if (USE_MOCK_CATEGORY) {
|
||||
categoryTree.value = enrichWithIcons(MOCK_CATEGORY_TREE)
|
||||
isCategoryInitializing.value = true
|
||||
initCategorySelection()
|
||||
isCategoryInitializing.value = false
|
||||
loadEventListAfterCategoryReady()
|
||||
} else {
|
||||
try {
|
||||
@ -272,7 +277,9 @@ async function loadCategory() {
|
||||
} catch {
|
||||
categoryTree.value = enrichWithIcons(MOCK_CATEGORY_TREE)
|
||||
}
|
||||
isCategoryInitializing.value = true
|
||||
initCategorySelection()
|
||||
isCategoryInitializing.value = false
|
||||
loadEventListAfterCategoryReady()
|
||||
}
|
||||
}
|
||||
@ -287,6 +294,18 @@ watch(
|
||||
},
|
||||
)
|
||||
|
||||
// 监听 categoryLayers 和 layerActiveValues 变化,自动刷新事件列表
|
||||
watch(
|
||||
[categoryLayers, layerActiveValues],
|
||||
() => {
|
||||
if (isCategoryInitializing.value) return
|
||||
clearEventListCache()
|
||||
eventPage.value = 1
|
||||
loadEvents(1, false, activeSearchKeyword.value)
|
||||
},
|
||||
{ deep: true },
|
||||
)
|
||||
|
||||
function onOrderSuccess() {
|
||||
tradeDialogOpen.value = false
|
||||
toastStore.show(t('toast.orderSuccess'))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user