File tree Expand file tree Collapse file tree 3 files changed +35
-6
lines changed
Expand file tree Collapse file tree 3 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,34 @@ definePageMeta({
99
1010const proseStore = useProseStore ()
1111
12- async function fetchData () {
13- await proseStore .fetchProse ()
12+ function fetch () {
13+ proseStore .fetchProse ()
1414}
1515
16- fetchData ()
16+ function clear() {
17+ proseStore .clearProse ()
18+ }
1719 </script >
1820
1921<template >
2022 <div >
21- {{ proseStore.prose }}
23+ <div class =" h-300 flex items-center justify-center rounded-15 bg-white p-16 dark:bg-[--van-background-2]" >
24+ <div v-if =" proseStore.prose" class =" text-16 leading-26" >
25+ {{ proseStore.prose }}
26+ </div >
27+
28+ <ClientOnly v-else >
29+ <van-empty :description =" $t('prose_page.btn_empty_desc')" />
30+ </ClientOnly >
31+ </div >
32+
33+ <van-space class =" m-10" direction =" vertical" fill >
34+ <van-button type =" primary" round block @click =" fetch" >
35+ {{ $t('prose_page.btn_fetch') }}
36+ </van-button >
37+ <van-button type =" default" round block @click =" clear" >
38+ {{ $t('prose_page.btn_clear') }}
39+ </van-button >
40+ </van-space >
2241 </div >
2342</template >
Original file line number Diff line number Diff line change 88 "unocssExample" : " 🎨 Unocss example" ,
99 "keepAlive" : " 🧡 KeepAlive Demo" ,
1010 "persistPiniaState" : " 💾 Persist Pinia State" ,
11- "fetch" : " 🌐 Network Request"
11+ "fetch" : " 🏄 Network Request"
1212 },
1313 "tabbar" : {
1414 "home" : " Home" ,
3333 "label" : " This is a simple example of persisting Pinia state. To verify its effectiveness, you can refresh the interface and observe it." ,
3434 "label_num" : " Number" ,
3535 "btn_add" : " Add"
36+ },
37+ "prose_page" : {
38+ "btn_fetch" : " Fetch" ,
39+ "btn_clear" : " Clear" ,
40+ "btn_empty_desc" : " No data"
3641 }
3742}
Original file line number Diff line number Diff line change 88 "unocssExample" : " 🎨 Unocss 示例" ,
99 "keepAlive" : " 🧡 KeepAlive 演示" ,
1010 "persistPiniaState" : " 💾 持久化 Pinia 状态" ,
11- "fetch" : " 🌐 网络请求"
11+ "fetch" : " 🏄 网络请求"
1212 },
1313 "tabbar" : {
1414 "home" : " 主页" ,
3333 "label" : " 这是一个简单的持久化 Pinia 状态的例子。为了验证其有效性,你可以刷新界面并观察它。" ,
3434 "label_num" : " 数字" ,
3535 "btn_add" : " 增加"
36+ },
37+ "prose_page" : {
38+ "btn_fetch" : " 拉取" ,
39+ "btn_clear" : " 清空" ,
40+ "btn_empty_desc" : " 暂无数据"
3641 }
3742}
You can’t perform that action at this time.
0 commit comments