feat(minihome): 添加页面加载时处理用户参数逻辑
在页面加载时获取并处理用户参数,若存在手机号则存储为token
This commit is contained in:
parent
3b156d7768
commit
16b84d9d19
|
|
@ -108,7 +108,7 @@ import RankListMini from "@/components/RankListMini.vue";
|
||||||
import MineMini from "@/components/mineMini.vue";
|
import MineMini from "@/components/mineMini.vue";
|
||||||
import Tabs from "@/components/mini/Tabs.vue";
|
import Tabs from "@/components/mini/Tabs.vue";
|
||||||
import { getTopNews } from "@/api/newsInfo";
|
import { getTopNews } from "@/api/newsInfo";
|
||||||
import { onPageNotFound, onPageScroll, onShow } from "@dcloudio/uni-app";
|
import { onLoad, onPageNotFound, onPageScroll, onShow } from "@dcloudio/uni-app";
|
||||||
import { getNavHeight } from "@/utils/util";
|
import { getNavHeight } from "@/utils/util";
|
||||||
import Domestic from "@/components/domesticMini.vue";
|
import Domestic from "@/components/domesticMini.vue";
|
||||||
|
|
||||||
|
|
@ -180,6 +180,16 @@ onShow(() => {
|
||||||
uni.setStorageSync("homeTabIndex", null);
|
uni.setStorageSync("homeTabIndex", null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const userParams = ref({});
|
||||||
|
|
||||||
|
onLoad((option) => {
|
||||||
|
console.log("🚀 ~ option:", option);
|
||||||
|
userParams.value = option;
|
||||||
|
if (userParams.value.phone) {
|
||||||
|
uni.setStorageSync("token", userParams.value.phone);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
getNewsList();
|
getNewsList();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue