fix
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
设置
|
设置
|
||||||
</van-tabbar-item>
|
</van-tabbar-item>
|
||||||
</van-tabbar>
|
</van-tabbar>
|
||||||
<GlobalAddBill @success="handleAddTransactionSuccess"/>
|
<GlobalAddBill v-if="isShowAddBill" @success="handleAddTransactionSuccess"/>
|
||||||
|
|
||||||
<div v-if="needRefresh" class="update-toast" @click="updateServiceWorker">
|
<div v-if="needRefresh" class="update-toast" @click="updateServiceWorker">
|
||||||
<van-icon name="upgrade" class="update-icon" />
|
<van-icon name="upgrade" class="update-icon" />
|
||||||
@@ -117,6 +117,13 @@ const setActive = (path) => {
|
|||||||
console.log(active.value, path)
|
console.log(active.value, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isShowAddBill = computed(() => {
|
||||||
|
return route.path === '/'
|
||||||
|
|| route.path === '/calendar'
|
||||||
|
|| route.path === '/balance'
|
||||||
|
|| route.path === '/message'
|
||||||
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
if (mediaQuery) {
|
if (mediaQuery) {
|
||||||
mediaQuery.removeEventListener('change', updateTheme)
|
mediaQuery.removeEventListener('change', updateTheme)
|
||||||
|
|||||||
@@ -756,7 +756,11 @@ const onSmartClassifySave = async () => {
|
|||||||
|
|
||||||
// 刷新统计数据
|
// 刷新统计数据
|
||||||
await fetchStatistics()
|
await fetchStatistics()
|
||||||
try { window.dispatchEvent(new CustomEvent('transactions-changed', { detail: { reason: selectedClassify.value, type: selectedType.value } })) } catch(e) {}
|
try {
|
||||||
|
window.dispatchEvent(new CustomEvent('transactions-changed', { detail: { reason: selectedClassify.value, type: selectedType.value } }))
|
||||||
|
} catch(e) {
|
||||||
|
console.error('触发 transactions-changed 事件失败:', e)
|
||||||
|
}
|
||||||
|
|
||||||
showToast('智能分类已保存')
|
showToast('智能分类已保存')
|
||||||
}
|
}
|
||||||
@@ -791,7 +795,7 @@ onActivated(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 全局监听交易删除事件,确保统计数据一致
|
// 全局监听交易删除事件,确保统计数据一致
|
||||||
const onGlobalTransactionDeleted = (e) => {
|
const onGlobalTransactionDeleted = () => {
|
||||||
// e.detail contains transaction id
|
// e.detail contains transaction id
|
||||||
fetchStatistics()
|
fetchStatistics()
|
||||||
}
|
}
|
||||||
@@ -802,7 +806,7 @@ onBeforeUnmount(() => {
|
|||||||
window.removeEventListener && window.removeEventListener('transaction-deleted', onGlobalTransactionDeleted)
|
window.removeEventListener && window.removeEventListener('transaction-deleted', onGlobalTransactionDeleted)
|
||||||
})
|
})
|
||||||
|
|
||||||
const onGlobalTransactionsChanged = (e) => {
|
const onGlobalTransactionsChanged = () => {
|
||||||
fetchStatistics()
|
fetchStatistics()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user