Explorar o código

feat: tabbar 支持4种图标

菲鸽 %!s(int64=2) %!d(string=hai) anos
pai
achega
b11b17ec40

+ 1 - 0
.stylelintrc.cjs

@@ -53,5 +53,6 @@ module.exports = {
     'no-duplicate-selectors': null,
     'no-duplicate-selectors': null,
     'scss/comment-no-empty': null,
     'scss/comment-no-empty': null,
     'selector-class-pattern': null,
     'selector-class-pattern': null,
+    'font-family-no-missing-generic-family-keyword': null,
   },
   },
 }
 }

+ 1 - 0
.vscode/settings.json

@@ -39,6 +39,7 @@
     "climblee",
     "climblee",
     "commitlint",
     "commitlint",
     "dcloudio",
     "dcloudio",
+    "iconfont",
     "qrcode",
     "qrcode",
     "refresherrefresh",
     "refresherrefresh",
     "scrolltolower",
     "scrolltolower",

+ 9 - 3
pages.config.ts

@@ -37,14 +37,20 @@ export default defineUniPages({
       {
       {
         pagePath: 'pages/index/about',
         pagePath: 'pages/index/about',
         text: '关于',
         text: '关于',
-        icon: 'i-carbon-3d-mpr-toggle',
+        icon: 'i-carbon-code',
         iconType: 'unocss',
         iconType: 'unocss',
       },
       },
+      // {
+      //   pagePath: 'pages/my/index',
+      //   text: '我的',
+      //   icon: '/static/logo.svg',
+      //   iconType: 'local',
+      // },
       {
       {
         pagePath: 'pages/my/index',
         pagePath: 'pages/my/index',
         text: '我的',
         text: '我的',
-        icon: '/static/logo.svg',
-        iconType: 'local',
+        icon: 'iconfont icon-my',
+        iconType: 'iconfont',
       },
       },
     ],
     ],
   },
   },

+ 5 - 2
src/components/fg-tabbar/fg-tabbar.vue

@@ -13,7 +13,10 @@
         :title="item.text"
         :title="item.text"
         :icon="item.icon"
         :icon="item.icon"
       ></wd-tabbar-item>
       ></wd-tabbar-item>
-      <wd-tabbar-item v-else-if="item.iconType === 'unocss'" :title="item.text">
+      <wd-tabbar-item
+        v-else-if="item.iconType === 'unocss' || item.iconType === 'iconfont'"
+        :title="item.text"
+      >
         <template #icon>
         <template #icon>
           <view
           <view
             h-40rpx
             h-40rpx
@@ -33,7 +36,7 @@
 
 
 <script setup lang="ts">
 <script setup lang="ts">
 // unocss icon 默认不生效,需要在这里写一遍才能生效!注释掉也是生效的,但是必须要有!
 // unocss icon 默认不生效,需要在这里写一遍才能生效!注释掉也是生效的,但是必须要有!
-// i-carbon-3d-mpr-toggle
+// i-carbon-code
 import { tabBar } from '@/pages.json'
 import { tabBar } from '@/pages.json'
 import { tabbarStore } from './tabbar'
 import { tabbarStore } from './tabbar'
 
 

+ 3 - 3
src/pages.json

@@ -33,14 +33,14 @@
       {
       {
         "pagePath": "pages/index/about",
         "pagePath": "pages/index/about",
         "text": "关于",
         "text": "关于",
-        "icon": "i-carbon-3d-mpr-toggle",
+        "icon": "i-carbon-code",
         "iconType": "unocss"
         "iconType": "unocss"
       },
       },
       {
       {
         "pagePath": "pages/my/index",
         "pagePath": "pages/my/index",
         "text": "我的",
         "text": "我的",
-        "icon": "/static/logo.svg",
-        "iconType": "local"
+        "icon": "iconfont icon-my",
+        "iconType": "iconfont"
       }
       }
     ]
     ]
   },
   },

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 28 - 0
src/style/iconfont.css


+ 2 - 0
src/style/index.scss

@@ -1,3 +1,5 @@
+@import './iconfont.css';
+
 .test {
 .test {
   // 可以通过 @apply 多个样式封装整体样式
   // 可以通过 @apply 多个样式封装整体样式
   @apply mt-4 ml-4;
   @apply mt-4 ml-4;