fix: 修复用户参数初始化及存储问题
将userParams的初始化提前到组件加载时,确保在onLoad中能正确存储token。同时移除重复的userParams赋值逻辑。
This commit is contained in:
parent
90e01e8009
commit
cae58ccd3f
|
|
@ -197,6 +197,7 @@ const handleSwiperJump = (item: any) => {
|
||||||
userParams.value.userType +
|
userParams.value.userType +
|
||||||
"&type=" +
|
"&type=" +
|
||||||
item.type;
|
item.type;
|
||||||
|
console.log("🚀 ~ handleSwiperJump ~ shareUrl:", shareUrl);
|
||||||
wx.miniProgram.navigateTo({
|
wx.miniProgram.navigateTo({
|
||||||
url: "/pages/webView/index?url=" + encodeURIComponent(shareUrl),
|
url: "/pages/webView/index?url=" + encodeURIComponent(shareUrl),
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
|
@ -214,7 +215,7 @@ const handleChange = (val: string) => {
|
||||||
inputValue.value = "";
|
inputValue.value = "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const userParams = ref({});
|
||||||
const keyWord = ref();
|
const keyWord = ref();
|
||||||
onLoad((e) => {
|
onLoad((e) => {
|
||||||
if (e?.keyWord) {
|
if (e?.keyWord) {
|
||||||
|
|
@ -224,17 +225,16 @@ onLoad((e) => {
|
||||||
screenList.value = [];
|
screenList.value = [];
|
||||||
// articleList.value.push(...searchList);
|
// articleList.value.push(...searchList);
|
||||||
handleChange(keyWord.value);
|
handleChange(keyWord.value);
|
||||||
});
|
|
||||||
|
|
||||||
const userParams = ref({});
|
userParams.value = e;
|
||||||
const onload = (option) => {
|
|
||||||
page.value++;
|
|
||||||
getData();
|
|
||||||
|
|
||||||
userParams.value = option;
|
|
||||||
if (userParams.value.phone) {
|
if (userParams.value.phone) {
|
||||||
uni.setStorageSync("token", userParams.value.phone);
|
uni.setStorageSync("token", userParams.value.phone);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const onload = (option) => {
|
||||||
|
page.value++;
|
||||||
|
getData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue