fix: 修复用户参数初始化及存储问题

将userParams的初始化提前到组件加载时,确保在onLoad中能正确存储token。同时移除重复的userParams赋值逻辑。
This commit is contained in:
34701892@qq.com 2026-01-15 09:27:24 +08:00
parent 90e01e8009
commit cae58ccd3f
1 changed files with 8 additions and 8 deletions

View File

@ -197,6 +197,7 @@ const handleSwiperJump = (item: any) => {
userParams.value.userType +
"&type=" +
item.type;
console.log("🚀 ~ handleSwiperJump ~ shareUrl:", shareUrl);
wx.miniProgram.navigateTo({
url: "/pages/webView/index?url=" + encodeURIComponent(shareUrl),
success: (res) => {
@ -214,7 +215,7 @@ const handleChange = (val: string) => {
inputValue.value = "";
}
};
const userParams = ref({});
const keyWord = ref();
onLoad((e) => {
if (e?.keyWord) {
@ -224,17 +225,16 @@ onLoad((e) => {
screenList.value = [];
// articleList.value.push(...searchList);
handleChange(keyWord.value);
});
const userParams = ref({});
const onload = (option) => {
page.value++;
getData();
userParams.value = option;
userParams.value = e;
if (userParams.value.phone) {
uni.setStorageSync("token", userParams.value.phone);
}
});
const onload = (option) => {
page.value++;
getData();
};
const getData = async () => {