Преглед изворни кода

feat(首页): 添加前往示例页的按钮和跳转功能

新增 gotoAbout 方法实现页面跳转功能,并在首页添加对应的按钮
feige996 пре 7 месеци
родитељ
комит
fc04ecc097
1 измењених фајлова са 13 додато и 0 уклоњено
  1. 13 0
      src/pages/index/index.vue

+ 13 - 0
src/pages/index/index.vue

@@ -25,6 +25,14 @@ console.log('index/index 首页打印了')
 onLoad(() => {
   console.log('测试 uni API 自动引入: onLoad')
 })
+
+// #region gotoAbout
+function gotoAbout() {
+  uni.navigateTo({
+    url: '/pages-sub/about/about',
+  })
+}
+// #endregion
 </script>
 
 <template>
@@ -96,6 +104,11 @@ onLoad(() => {
         https://wot-design-uni.cn
       </text>
     </view>
+    <view class="mt-4 text-center">
+      <wd-button type="primary" class="ml-2" @click="gotoAbout">
+        前往示例页
+      </wd-button>
+    </view>
     <view class="h-6" />
   </view>
 </template>