浏览代码

upd: 主题色文案添加

richard1015 3 年之前
父节点
当前提交
2a7c3bd5c0

+ 4 - 2
src/sites/doc/components/Header.vue

@@ -1,12 +1,14 @@
 <template>
   <div class="doc-header" :class="themeName()">
     <div class="header-logo">
-      <a class="logo-link" href="#" @click="toHome"></a>
+      <a class="logo-link" href="#/base"></a>
       <span class="logo-border"></span>
       <span class="version">{{ version }}</span>
     </div>
     <div class="header-nav">
-      <a href="https://github.com/jdf2e/nutui/tree/theme" target="_blank">🌈 主题定制 </a>
+      <a href="https://www.bilibili.com/video/BV1fi4y1D7qb" target="_blank"
+        >🌈 &nbsp;&nbsp;视频教程 「一分钟快速实现主题定制」 https://www.bilibili.com/video/BV1fi4y1D7qb</a
+      >
     </div>
   </div>
 </template>

+ 1 - 0
src/sites/doc/components/ThemeSetting/Index.vue

@@ -7,6 +7,7 @@
     <n-divider />
     <ul>
       <li :key="item.key" v-for="item in formItems">
+        <p>{{ item.key_zh }}</p>
         <p
           ><b>{{ item.key }}</b
           >: {{ item.value }} (<del>{{ item.rawValue }}</del

+ 5 - 1
src/sites/doc/components/ThemeSetting/helper.ts

@@ -47,7 +47,10 @@ const awaitIframe = async () => {
     await new Promise((r) => setTimeout(r, 100));
   }
 };
-
+const zhKeyDesc = {
+  '$primary-color': '全局主题色',
+  '$primary-color-end': '全局主题色结束颜色(主题色渐变,例如 Buton)'
+} as any;
 // 提取变量
 const extractVariables = (matched: string[], name: string, lowerCaseName: string) =>
   matched.reduce((res, str) => {
@@ -60,6 +63,7 @@ const extractVariables = (matched: string[], name: string, lowerCaseName: string
         name, // 组件名
         lowerCaseName, // 组件名小写
         key, // 变量名
+        key_zh: zhKeyDesc[key],
         rawValue: value, // 原始值
         computedRawValue: '', // 计算后的原始值
         value, // 编辑的值

+ 3 - 3
src/sites/doc/router.ts

@@ -35,8 +35,8 @@ for (const path in modulesPageTaro) {
 
 const routes: Array<RouteRecordRaw> = [
   {
-    path: '/',
-    name: '/',
+    path: '/main',
+    name: 'main',
     component: Index,
     children: pagesRouter
   }
@@ -45,7 +45,7 @@ routes.push({
   name: 'notFound',
   path: '/:path(.*)+',
   redirect: {
-    name: '/'
+    name: 'base'
   }
 });
 const router = createRouter({