From 41e074568626c68bfef457a8ab59525fb93267f2 Mon Sep 17 00:00:00 2001 From: Wayne Hsu Date: Sun, 19 Feb 2023 14:33:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E8=84=88=E7=B4=80=E9=8C=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Home.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/views/Home.vue b/src/views/Home.vue index 2df2889..a857405 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -136,6 +136,7 @@ export default { var u = navigator.userAgent; isIOs.value = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); + const uc_temp = ref() onBeforeMount(async () => { @@ -194,6 +195,8 @@ export default { saveConnection(card1Res.data) } + + }) // activeName.value = '0' @@ -264,7 +267,6 @@ export default { const showUserConn = ref(false) async function saveConnection(data){ - let connData = { userid: data.user_id, name: data.name, @@ -294,16 +296,16 @@ export default { if(Cookies.get('token')){ let res = await uploadUserConnections(JSON.stringify(n_user_conn)) + if(res.code === 200){ + uc_temp.value = n_user_conn + } } } - const userConnections = computed(async ()=>{ - if(Cookies.get('token')){ - let res = await getUserConnections() - if(res.code === 200){ - return JSON.parse(res.data) - } + const userConnections = computed(()=>{ + if(uc_temp.value && uc_temp.value.length > 0){ + return uc_temp.value } return JSON.parse(localStorage.getItem('user_conn')) })