Explorar el Código

docs(tabbar): 更新注释说明并添加接口调用示例

更新store.ts中关于customTabbarList接口调用的注释说明
在index.vue中添加接口调用示例代码
feige996 hace 8 meses
padre
commit
a380712886
Se han modificado 2 ficheros con 9 adiciones y 1 borrados
  1. 7 0
      src/tabbar/index.vue
  2. 2 1
      src/tabbar/store.ts

+ 7 - 0
src/tabbar/index.vue

@@ -1,5 +1,6 @@
 <script setup lang="ts">
 // 'i-carbon-code',
+import { http } from '@/http/http'
 import { customTabbarEnable, nativeTabbarNeedHide, tabbarCacheEnable } from './config'
 import { tabbarStore } from './store'
 
@@ -10,6 +11,12 @@ defineOptions({
 })
 // #endif
 
+// #region 接口获取tabbar demo
+http.get('/foo').then((res) => {
+  console.log('接口获取tabbar demo', res)
+})
+// #endregion
+
 // TODO 1/2: 中间的鼓包tabbarItem的开关
 const BULGE_ENABLE = false
 function handleClickBulge() {

+ 2 - 1
src/tabbar/store.ts

@@ -9,8 +9,9 @@ interface CustomTabBarItem {
   badge?: number | 'dot' // badge 显示一个数字或 小红点(样式可以直接在 tabbar/index.vue 里面修改)
   isBulge?: boolean // 是否是中间的鼓包tabbarItem
 }
+
 // pagePath 是 nativeTabbarList 和 customTabbarList 的关联点,如果没有对应上,会有问题!!
-// 如果希望通过接口调用 customTabbarList,可以在文件里面调用接口
+// 如果希望通过接口调用 customTabbarList,可以在 tabbar/index.vue 文件里面调用接口
 export const customTabbarList: CustomTabBarItem[] = [
   {
     // text 和 pagePath 可以自己直接写,也可以通过索引从 nativeTabbarList 中获取