Browse Source

fix: toast env devp bug

richard1015 3 years ago
parent
commit
37f6902b0f
3 changed files with 17 additions and 15 deletions
  1. 3 0
      src/packages/__VUE/toast/doc.taro.md
  2. 7 3
      src/sites/doc/router.ts
  3. 7 12
      src/sites/doc/views/Index.vue

+ 3 - 0
src/packages/__VUE/toast/doc.taro.md

@@ -4,6 +4,9 @@
 
 用于轻提示。
 
+>当前组件 Taro 环境暂不支持函数式调用,推荐使用 Taro.API 使用原生组件 https://taro-docs.jd.com/taro/docs/apis/ui/interaction/showToast
+
+
 ### 安装
 
 ``` javascript

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

@@ -32,9 +32,13 @@ const modulesPageTaro = import.meta.glob('/src/packages/__VUE/**/*.taro.md');
 for (const path in modulesPageTaro) {
   let name = (/packages\/__VUE\/(.*)\/doc.taro.md/.exec(path) as any[])[1];
   pagesRouter.push({
-    path: `/${name}-taro`,
-    component: modulesPageTaro[path],
-    name: `${name}-taro`
+    path: `/zh-CN//${name}-taro`,
+    component: modulesPageTaro[path]
+    // name: `${name}-taro`
+  });
+  pagesRouter.push({
+    path: `/en-US/${name}-taro`,
+    component: modulesPageTaro[path]
   });
 }
 

+ 7 - 12
src/sites/doc/views/Index.vue

@@ -3,14 +3,14 @@
     <doc-header></doc-header>
     <doc-nav></doc-nav>
     <div class="doc-content">
-      <div class="doc-title" v-if="isShow()">
+      <div class="doc-title">
         <div class="doc-title-position" :class="{ fixed: fixed, hidden: hidden }">
           <div class="title">{{ componentName.name }}&nbsp;{{ componentName.cName }}</div>
           <doc-issue class=""></doc-issue>
         </div>
       </div>
-      <div class="doc-content-document" :class="{ isComponent: isShow() }">
-        <div class="doc-content-tabs" v-if="isShow() && isShowTaroDoc">
+      <div class="doc-content-document isComponent">
+        <div class="doc-content-tabs" v-if="isShowTaroDoc">
           <div
             class="tab-item"
             :class="{ cur: curKey === item.key }"
@@ -20,12 +20,12 @@
             >{{ item.text }}</div
           >
         </div>
-        <div class="doc-content-tabs single" v-if="isShow() && !isShowTaroDoc">
+        <div class="doc-content-tabs single" v-if="!isShowTaroDoc">
           <div class="tab-item cur">vue / taro</div>
         </div>
         <router-view />
       </div>
-      <doc-demo-preview v-if="isShow()" :url="demoUrl" :class="{ fixed: fixed }"></doc-demo-preview>
+      <doc-demo-preview :url="demoUrl" :class="{ fixed: fixed }"></doc-demo-preview>
     </div>
   </div>
 </template>
@@ -94,13 +94,9 @@ export default defineComponent({
       return router.path.indexOf('taro') > -1;
     };
 
-    const isShow = () => {
-      // return !excludeTaro.includes(route.path);
-      return route.path != 'zh-CN/' || 'zh-TW/' || 'en-US/';
-    };
-
     const isShowTaroDoc = computed(() => {
-      return configNav.value.findIndex((item) => item === route.path.substr(1)) > -1;
+      let routename = route.path.toLocaleLowerCase().split('/').pop() || '';
+      return configNav.value.findIndex((item) => item === routename) > -1;
     });
 
     const watchDemoUrl = (router: RouteLocationNormalized) => {
@@ -184,7 +180,6 @@ export default defineComponent({
       ...toRefs(state),
       ...toRefs(data),
       handleTabs,
-      isShow,
       isShowTaroDoc
     };
   }