From 40732df4d8542aabfc67ea52c894ca4468ffe3c9 Mon Sep 17 00:00:00 2001
From: feige996 <1020102647@qq.com>
Date: Mon, 1 Sep 2025 15:52:59 +0800
Subject: [PATCH] =?UTF-8?q?refactor(about):=20=E9=87=8D=E5=91=BD=E5=90=8D?=
=?UTF-8?q?=E5=87=BD=E6=95=B0=E5=B9=B6=E9=87=8D=E6=96=B0=E7=BB=84=E7=BB=87?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
将 toLogin 重命名为 gotoLogin 以保持命名一致性
调整函数位置使相关功能更集中
---
src/pages/about/about.vue | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/pages/about/about.vue b/src/pages/about/about.vue
index 00928ca..bd3e956 100644
--- a/src/pages/about/about.vue
+++ b/src/pages/about/about.vue
@@ -22,12 +22,23 @@ definePage({
// 浏览器打印 isH5为true, isWeb为false,大家尽量用 isH5
console.log({ isApp, isAppAndroid, isAppHarmony, isAppIOS, isAppPlus, isH5, isMpWeixin, isWeb })
-function toLogin() {
+function gotoLogin() {
uni.navigateTo({
url: `${LOGIN_PAGE}?redirect=${encodeURIComponent('/pages/about/about?a=1&b=2')}`,
})
}
+function gotoTabbar() {
+ uni.switchTab({
+ url: '/pages/index/index',
+ })
+}
+// #region setTabbarBadge
+function setTabbarBadge() {
+ tabbarStore.setTabbarItemBadge(1, 100)
+}
+// #endregion
+
function gotoAlova() {
uni.navigateTo({
url: '/pages/about/alova',
@@ -43,6 +54,7 @@ function gotoSubPage() {
url: '/pages-sub/demo/index',
})
}
+
// uniLayout里面的变量通过 expose 暴露出来后可以在 onReady 钩子获取到(onLoad 钩子不行)
const uniLayout = ref()
onLoad(() => {
@@ -58,17 +70,6 @@ onShow(() => {
console.log('onShow:', uniLayout.value?.testUniLayoutExposedData) // onReady: testUniLayoutExposedData
})
-function gotoTabbar() {
- uni.switchTab({
- url: '/pages/index/index',
- })
-}
-// #region setTabbarBadge
-function setTabbarBadge() {
- tabbarStore.setTabbarItemBadge(1, 100)
-}
-// #endregion
-
const uniKuRoot = ref()
// 结论:(同上)第一次通过onShow获取不到,但是可以通过 onReady获取到,后面就可以通过onShow获取到了
onReady(() => {
@@ -87,7 +88,7 @@ onShow(() => {
-