Showing
3 changed files
with
15 additions
and
11 deletions
| ... | @@ -13,6 +13,10 @@ export const useUnwatchList = () => { | ... | @@ -13,6 +13,10 @@ export const useUnwatchList = () => { |
| 13 | const loading = ref(false); | 13 | const loading = ref(false); |
| 14 | const finished = ref(false); | 14 | const finished = ref(false); |
| 15 | 15 | ||
| 16 | + // 因为不能让空图标提前出来的写法 | ||
| 17 | + const finishedTextStatus = ref(false); | ||
| 18 | + const emptyStatus = ref(false); | ||
| 19 | + | ||
| 16 | /** | 20 | /** |
| 17 | * 向下滚动查询数据 | 21 | * 向下滚动查询数据 |
| 18 | */ | 22 | */ |
| ... | @@ -38,6 +42,11 @@ export const useUnwatchList = () => { | ... | @@ -38,6 +42,11 @@ export const useUnwatchList = () => { |
| 38 | // 加载状态结束 | 42 | // 加载状态结束 |
| 39 | finished.value = true; | 43 | finished.value = true; |
| 40 | } | 44 | } |
| 45 | + // 空数据提示 | ||
| 46 | + if (!prod_list.value.length) { | ||
| 47 | + finishedTextStatus.value = false; | ||
| 48 | + emptyStatus.value = true; | ||
| 49 | + } | ||
| 41 | } else { | 50 | } else { |
| 42 | // tslint:disable-next-line: no-console | 51 | // tslint:disable-next-line: no-console |
| 43 | console.warn(res); | 52 | console.warn(res); |
| ... | @@ -58,6 +67,8 @@ export const useUnwatchList = () => { | ... | @@ -58,6 +67,8 @@ export const useUnwatchList = () => { |
| 58 | onLoad, | 67 | onLoad, |
| 59 | prod_list, | 68 | prod_list, |
| 60 | finished, | 69 | finished, |
| 61 | - loading | 70 | + loading, |
| 71 | + finishedTextStatus, | ||
| 72 | + emptyStatus, | ||
| 62 | } | 73 | } |
| 63 | } | 74 | } | ... | ... |
| ... | @@ -45,7 +45,7 @@ axios.get('/srv/?a=my_follow') | ... | @@ -45,7 +45,7 @@ axios.get('/srv/?a=my_follow') |
| 45 | .then(res => { | 45 | .then(res => { |
| 46 | if (res.data.code === 1) { | 46 | if (res.data.code === 1) { |
| 47 | followList.value = res.data.data; | 47 | followList.value = res.data.data; |
| 48 | - if (!res.data.data.value.length) { | 48 | + if (!res.data.data.length) { |
| 49 | emptyStatus.value = true; | 49 | emptyStatus.value = true; |
| 50 | } | 50 | } |
| 51 | } else { | 51 | } else { | ... | ... |
| ... | @@ -11,7 +11,7 @@ | ... | @@ -11,7 +11,7 @@ |
| 11 | <van-empty v-if="emptyStatus" | 11 | <van-empty v-if="emptyStatus" |
| 12 | class="custom-image" | 12 | class="custom-image" |
| 13 | :image="no_image" | 13 | :image="no_image" |
| 14 | - description="暂无关注" | 14 | + description="暂无未看" |
| 15 | /> | 15 | /> |
| 16 | </div> | 16 | </div> |
| 17 | </template> | 17 | </template> |
| ... | @@ -33,7 +33,7 @@ import { wxInfo } from '@/utils/tools'; | ... | @@ -33,7 +33,7 @@ import { wxInfo } from '@/utils/tools'; |
| 33 | 33 | ||
| 34 | const $router = useRouter(); | 34 | const $router = useRouter(); |
| 35 | 35 | ||
| 36 | -const { onLoad, prod_list, finished, loading } = useUnwatchList(); | 36 | +const { onLoad, prod_list, finished, loading, finishedTextStatus, emptyStatus } = useUnwatchList(); |
| 37 | 37 | ||
| 38 | /****************** keepAlive 模块 *******************/ | 38 | /****************** keepAlive 模块 *******************/ |
| 39 | 39 | ||
| ... | @@ -91,13 +91,6 @@ onBeforeRouteLeave((to, from) => { | ... | @@ -91,13 +91,6 @@ onBeforeRouteLeave((to, from) => { |
| 91 | 91 | ||
| 92 | /*********************************************************/ | 92 | /*********************************************************/ |
| 93 | 93 | ||
| 94 | -// 因为不能让空图标提前出来的写法 | ||
| 95 | -const finishedTextStatus = ref(false); | ||
| 96 | -const emptyStatus = ref(false); | ||
| 97 | -if (!prod_list.value.length) { | ||
| 98 | - finishedTextStatus.value = false; | ||
| 99 | - emptyStatus.value = true; | ||
| 100 | -} | ||
| 101 | </script> | 94 | </script> |
| 102 | 95 | ||
| 103 | <script> | 96 | <script> | ... | ... |
-
Please register or login to post a comment