Prechádzať zdrojové kódy

feat(tabbar): 添加主题变量和项定义

EvilDragon 6 mesiacov pred
rodič
commit
80e15109f1
1 zmenil súbory, kde vykonal 52 pridanie a 0 odobranie
  1. 52 0
      src/layouts/tabbar.vue

+ 52 - 0
src/layouts/tabbar.vue

@@ -0,0 +1,52 @@
+<script setup lang="ts">
+import type { ConfigProviderThemeVars } from 'wot-design-uni'
+
+const themeVars: ConfigProviderThemeVars = {
+  // colorTheme: 'red',
+  buttonPrimaryBgColor: '#000',
+  // buttonPrimaryColor: '#07c160',
+}
+const items = [
+  { title: '首页', icon: 'home', iconPath: '/static/tabbar/home.svg', path: '/pages/index/index' },
+  {
+    title: '材料',
+    icon: 'home',
+    iconPath: '/static/tabbar/material.svg',
+    path: '/pages/material/index',
+  },
+  {
+    title: '发布',
+    icon: 'home',
+    iconPath: '/static/tabbar/publish.svg',
+    path: '/pages/publish/index',
+  },
+  {
+    title: '消息',
+    icon: 'home',
+    iconPath: '/static/tabbar/message.svg',
+    path: '/pages/messages/index',
+  },
+  { title: '我的', icon: 'home', iconPath: '/static/tabbar/mine.svg', path: '/pages/mine/index' },
+]
+</script>
+
+<template>
+  <wd-config-provider :themeVars="themeVars">
+    <view class="bg-[#f6f6f6] pb-20">
+      <slot />
+    </view>
+    <wd-tabbar fixed shape="round" safeAreaInsetBottom>
+      <template v-for="it of items" :key="it.id">
+        <wd-tabbar-item :title="it.title" :icon="it.icon">
+          <template #icon v-if="it.iconPath">
+            <wd-img round height="40rpx" width="40rpx" :src="it.iconPath"></wd-img>
+          </template>
+        </wd-tabbar-item>
+      </template>
+    </wd-tabbar>
+    <wd-toast />
+    <wd-message-box />
+  </wd-config-provider>
+</template>
+
+<style scoped lang="scss"></style>