feat: 添加 UI 状态管理,支持新增记录底部弹窗功能,优化设置和主页交互
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useTransactionStore } from '../stores/transactions'
|
||||
import { useUiStore } from '../stores/ui'
|
||||
|
||||
const router = useRouter()
|
||||
const transactionStore = useTransactionStore()
|
||||
const uiStore = useUiStore()
|
||||
const { groupedTransactions, filters, loading } = storeToRefs(transactionStore)
|
||||
const deletingId = ref('')
|
||||
|
||||
@@ -36,7 +36,7 @@ const formatTime = (value) =>
|
||||
)
|
||||
|
||||
const handleEdit = (item) => {
|
||||
router.push({ name: 'add', query: { id: item.id } })
|
||||
uiStore.openAddEntry(item.id)
|
||||
}
|
||||
|
||||
const handleDelete = async (item) => {
|
||||
@@ -63,7 +63,7 @@ transactionStore.ensureInitialized()
|
||||
<h2 class="text-2xl font-extrabold text-stone-800">账单明细</h2>
|
||||
<button
|
||||
class="flex items-center gap-2 bg-white border border-stone-100 px-3 py-1.5 rounded-full shadow-sm text-xs font-bold text-stone-500"
|
||||
@click="router.push({ name: 'add' })"
|
||||
@click="uiStore.openAddEntry()"
|
||||
>
|
||||
<i class="ph-bold ph-plus" /> 新增
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user