lifeifan 7 年之前
父节点
当前提交
6077e03b5c
共有 4 个文件被更改,包括 145 次插入141 次删除
  1. 2 2
      package.json
  2. 1 0
      sites/demo/index.html
  3. 141 138
      sites/doc/app.vue
  4. 1 1
      sites/doc/index.html

+ 2 - 2
package.json

@@ -1,7 +1,7 @@
 {
 {
   "name": "@nutui/nutui",
   "name": "@nutui/nutui",
-  "version": "2.0.0-beta.1",
-  "description": "一套移动端轻量级Vue组件库",
+  "version": "2.0.0-beta.2",
+  "description": "一套轻量级移动端Vue组件库",
   "typings": "dist/types/index.d.ts",
   "typings": "dist/types/index.d.ts",
   "main": "dist/nutui.js",
   "main": "dist/nutui.js",
   "files": [
   "files": [

+ 1 - 0
sites/demo/index.html

@@ -4,6 +4,7 @@
 <head>
 <head>
   <meta charset="utf-8" />
   <meta charset="utf-8" />
   <meta content="telephone=no" name="format-detection" />
   <meta content="telephone=no" name="format-detection" />
+  <link rel="shortcut icon" href="/favicon.ico">
   <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
   <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
   <title>NutUI - 移动端Vue组件库</title>
   <title>NutUI - 移动端Vue组件库</title>
   <script src="//misc.360buyimg.com/felibs/vue/2.5.16/vue.min.js"></script>
   <script src="//misc.360buyimg.com/felibs/vue/2.5.16/vue.min.js"></script>

+ 141 - 138
sites/doc/app.vue

@@ -1,87 +1,90 @@
 <template>
 <template>
- <div>
-  <div v-if="routerName == 'frontcover' || routerName == ''">
-     <router-view ></router-view>
-  </div>
-  <div class="md-swaper" @click="clearSearch" v-else>
-    <div class="hder">
-      <div class="logo">
-        <a href="#/index" class="logo-link"><img src="./asset/css/i/nut.png" alt></a> <span class="version">{{version}}</span>
-      </div>
-      <div class="h-nav">
-        <search/>
-        <ul class="list">
-          <li class="cur">
-            <a href="#/doc">指南</a>
-          </li>        
-          <li>
-            <a class="qrcode demoLink" href="/demo.html#/index" target="_blank">示例             
+  <div>
+    <div v-if="routerName == 'frontcover' || routerName == ''">
+      <router-view></router-view>
+    </div>
+    <div class="md-swaper" @click="clearSearch" v-else>
+      <div class="hder">
+        <div class="logo">
+          <a href="#/index" class="logo-link">
+            <img src="./asset/css/i/nut.png" alt>
+          </a>
+          <span class="version">{{version}}</span>
+        </div>
+        <div class="h-nav">
+          <search/>
+          <ul class="list">
+            <li class="cur">
+              <a href="#/doc">指南</a>
+            </li>
+            <li>
+              <a class="qrcode demoLink" href="/demo.html#/index" target="_blank">
+                示例
                 <a :href="routerName">
                 <a :href="routerName">
-                  <span>请使用手机扫码体验</span><img src="http://img13.360buyimg.com/uba/jfs/t1/14144/37/3433/5890/5c26d976E7cd98b80/94583409233081cc.png" alt="">
+                  <span>请使用手机扫码体验</span>
+                  <img
+                    src="http://img13.360buyimg.com/uba/jfs/t1/14144/37/3433/5890/5c26d976E7cd98b80/94583409233081cc.png"
+                    alt
+                  >
                 </a>
                 </a>
-            </a>
-          </li>
-          <li>
-            <select @change="openwindow">
-                <option value="2">
-                    2.X
-                </option>
-                <option value="1">
-                    1.X
-                </option>
-            </select>
-          </li>
-          <li class="github">
-
-            <a target="_back" href="https://github.com/jdf2e/nutui"></a>
-          </li>
-        </ul>
+              </a>
+            </li>
+            <li>
+              <select @change="openwindow">
+                <option value="2">2.X</option>
+                <option value="1">1.X</option>
+              </select>
+            </li>
+            <li class="github">
+              <a target="_back" href="https://github.com/jdf2e/nutui"></a>
+            </li>
+          </ul>
+        </div>
       </div>
       </div>
-    </div>
-    <div class="demo-wrapper">
-      <router-view class="demo-nav" name="demonav"></router-view>
+      <div class="demo-wrapper">
+        <router-view class="demo-nav" name="demonav"></router-view>
         <keep-alive include="index">
         <keep-alive include="index">
           <router-view class="doc-cont" name="main"></router-view>
           <router-view class="doc-cont" name="main"></router-view>
         </keep-alive>
         </keep-alive>
         <div v-if="showPhone" class="showPhone">
         <div v-if="showPhone" class="showPhone">
           <div class="ph">
           <div class="ph">
             <div class="bg">
             <div class="bg">
-              <img src="./asset/css/i/phtitle.png" alt="">
+              <img src="./asset/css/i/phtitle.png" alt>
               <div>
               <div>
-                <input type="text" readonly :value="'http://nutui.jd.com/demo.html#/'+routerName">
+                <input type="text" readonly :value="'http://nutui.jd.com/demo.html#/'+routerName+'?ver='+version">
               </div>
               </div>
             </div>
             </div>
-            <iframe :src="'/demo.html#/'+routerName"></iframe>
+            <iframe :src="'/demo.html#/'+routerName+'?ver='+version"></iframe>
           </div>
           </div>
         </div>
         </div>
-    </div>
-    <div class="foot">Copyright © 2018~2019
-      <a href="//jdc.jd.com" target="_blank">JDC</a>-
-      <a target="_blank" href="http://fe.jd.com/">前端开发部</a>
+      </div>
+      <div class="foot">
+        Copyright © 2018~2019
+        <a href="//jdc.jd.com" target="_blank">JDC</a>-
+        <a target="_blank" href="http://fe.jd.com/">前端开发部</a>
+      </div>
     </div>
     </div>
   </div>
   </div>
-  
- </div>
 </template>
 </template>
 <script>
 <script>
 import "./asset/css/common.scss";
 import "./asset/css/common.scss";
 import "./asset/css/style-blue.scss";
 import "./asset/css/style-blue.scss";
 import { packages } from "../../src/config.json";
 import { packages } from "../../src/config.json";
-import PackageJson from "../../package.json";
-import search from './search.vue';
+import { version } from "../../package.json";
+import search from "./search.vue";
 export default {
 export default {
   name: "App",
   name: "App",
   data() {
   data() {
     return {
     return {
-      packages: "",
+      packages,
       searchList: [],
       searchList: [],
       searchVal: "",
       searchVal: "",
       routerName: "",
       routerName: "",
       showPhone: false,
       showPhone: false,
-      searchCurName:'',
-      searchIndex:0,
-      codeurl:'',
-      version:''
+      searchCurName: "",
+      searchIndex: 0,
+      codeurl: "",
+      version
     };
     };
   },
   },
   watch: {
   watch: {
@@ -92,46 +95,45 @@ export default {
     //  },
     //  },
     $route: "fetchData"
     $route: "fetchData"
   },
   },
-  components:{
+  components: {
     search
     search
   },
   },
   methods: {
   methods: {
-    openwindow(val){      
-      if(val.target.value==1){
-        window.location.href=" http://nutui.jd.com/1x/"
+    openwindow(val) {
+      if (val.target.value == 1) {
+        window.location.href = " http://nutui.jd.com/1x/";
       }
       }
     },
     },
-    choseList(e){
-      console.log(e)
+    choseList(e) {
       let searchIndex = this.searchIndex;
       let searchIndex = this.searchIndex;
-      if(e.keyCode==40){
+      if (e.keyCode == 40) {
         searchIndex++;
         searchIndex++;
       }
       }
-      if(e.keyCode==38){
-         searchIndex--;
+      if (e.keyCode == 38) {
+        searchIndex--;
       }
       }
-      if(searchIndex<0){
+      if (searchIndex < 0) {
         searchIndex = 0;
         searchIndex = 0;
-      }      
+      }
       let searchList = this.searchList;
       let searchList = this.searchList;
-      if(searchList.length>0){       
-       let chnName = searchList[searchIndex].chnName;
-       if(chnName){
-         this.searchCurName = chnName;
-         this.searchIndex = searchIndex;
-         if(e.keyCode==13){
-          this.$router.push({
-            path:'/'+searchList[searchIndex].name
-          })
-           this.searchCurName='';
-           this.searchIndex=0;
-           this.searchList=[];
-           this.searchVal='';
+      if (searchList.length > 0) {
+        let chnName = searchList[searchIndex].chnName;
+        if (chnName) {
+          this.searchCurName = chnName;
+          this.searchIndex = searchIndex;
+          if (e.keyCode == 13) {
+            this.$router.push({
+              path: "/" + searchList[searchIndex].name
+            });
+            this.searchCurName = "";
+            this.searchIndex = 0;
+            this.searchList = [];
+            this.searchVal = "";
+          }
         }
         }
-       }       
       }
       }
     },
     },
-    fetchData(obj) {  
+    fetchData(obj) {
       this.routerName = obj.name;
       this.routerName = obj.name;
       this.showPhone = false;
       this.showPhone = false;
       for (let i = 0, item; (item = packages[i]); i++) {
       for (let i = 0, item; (item = packages[i]); i++) {
@@ -140,9 +142,13 @@ export default {
         }
         }
       }
       }
       let that = this;
       let that = this;
-      this.qrcode.toDataURL('http://nutui.jd.com/index.html#/'+that.routerName,{width:170},(err,url)=>{
-        that.codeurl = url
-      })
+      this.qrcode.toDataURL(
+        "http://nutui.jd.com/index.html#/" + that.routerName,
+        { width: 170 },
+        (err, url) => {
+          that.codeurl = url;
+        }
+      );
     },
     },
     onfocus(e) {
     onfocus(e) {
       e.target.select();
       e.target.select();
@@ -168,21 +174,18 @@ export default {
     checklist(obj) {
     checklist(obj) {
       this.searchVal = "";
       this.searchVal = "";
       this.searchList = [];
       this.searchList = [];
-      this.searchCurName='';
-      this.searchIndex=0;
+      this.searchCurName = "";
+      this.searchIndex = 0;
     }
     }
   },
   },
   created() {
   created() {
     let that = this;
     let that = this;
-    this.packages = packages;   
     let name = this.$route.name;
     let name = this.$route.name;
-    this.version = PackageJson.version; 
     for (let i = 0, item; (item = packages[i]); i++) {
     for (let i = 0, item; (item = packages[i]); i++) {
       if (name == item.name) {
       if (name == item.name) {
         this.showPhone = true;
         this.showPhone = true;
       }
       }
     }
     }
-     
   }
   }
 };
 };
 </script>
 </script>
@@ -215,31 +218,31 @@ export default {
   display: flex;
   display: flex;
   align-items: center;
   align-items: center;
   margin-bottom: 50px;
   margin-bottom: 50px;
-  z-index:42;
+  z-index: 42;
   .logo {
   .logo {
-    width: 295px;   
+    width: 295px;
     height: 65px;
     height: 65px;
     border-right: 1px solid #d8d8d8;
     border-right: 1px solid #d8d8d8;
     display: flex;
     display: flex;
-    align-items:center;
-    flex-shrink: 0;    
-    .logo-link{
-      display:inline-block;
+    align-items: center;
+    flex-shrink: 0;
+    .logo-link {
+      display: inline-block;
+    }
+    img {
+      display: block;
+      width: 120px;
+      height: 46px;
+      flex-grow: 0;
+      flex-shrink: 0;
+      margin: 0 10px 0 30px;
     }
     }
-    img{
-        display: block;
-        width: 120px;
-        height: 46px;
-        flex-grow: 0;
-        flex-shrink:0;
-         margin: 0 10px 0 30px;
-    }   
-    color:#999;
+    color: #999;
     font-size: 12px;
     font-size: 12px;
   }
   }
-  .version{
-    display:inline-block;
-    margin-top:7px;
+  .version {
+    display: inline-block;
+    margin-top: 7px;
     vertical-align: bottom;
     vertical-align: bottom;
   }
   }
 
 
@@ -248,12 +251,12 @@ export default {
     padding-left: 42px;
     padding-left: 42px;
     align-items: center;
     align-items: center;
     width: 100%;
     width: 100%;
-    select{
-      width:74px;
-      height:28px;
-      margin-top:18px;
-      margin-left:20px;
-      font-size:12px;
+    select {
+      width: 74px;
+      height: 28px;
+      margin-top: 18px;
+      margin-left: 20px;
+      font-size: 12px;
     }
     }
     .search-box {
     .search-box {
       height: 22px;
       height: 22px;
@@ -286,7 +289,7 @@ export default {
       li {
       li {
         height: 40px;
         height: 40px;
         line-height: 40px;
         line-height: 40px;
-        font-size:14px;
+        font-size: 14px;
         a {
         a {
           display: inline-block;
           display: inline-block;
           box-sizing: border-box;
           box-sizing: border-box;
@@ -303,12 +306,12 @@ export default {
           }
           }
         }
         }
       }
       }
-      .cur{
-          background: #6096ff;
+      .cur {
+        background: #6096ff;
+        color: #fff;
+        a {
           color: #fff;
           color: #fff;
-          a {
-            color: #fff;
-          }
+        }
       }
       }
     }
     }
   }
   }
@@ -317,7 +320,7 @@ export default {
     list-style: none;
     list-style: none;
     margin-left: auto;
     margin-left: auto;
     li {
     li {
-      padding:0 10px;
+      padding: 0 10px;
       height: 63px;
       height: 63px;
       line-height: 63px;
       line-height: 63px;
       text-align: center;
       text-align: center;
@@ -349,7 +352,7 @@ export default {
 
 
 .demo-wrapper {
 .demo-wrapper {
   display: flex;
   display: flex;
-  width:100%;
+  width: 100%;
 
 
   //padding: 0 20px 0 0;
   //padding: 0 20px 0 0;
   .demo-nav {
   .demo-nav {
@@ -357,7 +360,7 @@ export default {
     flex-shrink: 0;
     flex-shrink: 0;
   }
   }
   .showPhone {
   .showPhone {
-    padding-right:25px;
+    padding-right: 25px;
     //margin-left: 20px;
     //margin-left: 20px;
     width: 375px;
     width: 375px;
     flex-shrink: 0;
     flex-shrink: 0;
@@ -377,19 +380,19 @@ export default {
         width: 389px;
         width: 389px;
         height: 612px;
         height: 612px;
         padding: 5px 5px 5px 5px;
         padding: 5px 5px 5px 5px;
-        box-sizing: border-box;       
+        box-sizing: border-box;
       }
       }
-    }    
+    }
     .bg {
     .bg {
       width: 389px;
       width: 389px;
       height: 64px;
       height: 64px;
-      padding-top:5px;
-      background: linear-gradient(rgba(55,55,55,.98),#545456);
+      padding-top: 5px;
+      background: linear-gradient(rgba(55, 55, 55, 0.98), #545456);
       text-align: center;
       text-align: center;
-      img{
+      img {
         width: 350px;
         width: 350px;
       }
       }
-      input{           
+      input {
         width: 350px;
         width: 350px;
         height: 28px;
         height: 28px;
         line-height: 28px;
         line-height: 28px;
@@ -400,9 +403,9 @@ export default {
         white-space: nowrap;
         white-space: nowrap;
         overflow-x: scroll;
         overflow-x: scroll;
         border: none;
         border: none;
-        margin-top:5px;
+        margin-top: 5px;
         padding: 0 5px;
         padding: 0 5px;
-        &:focus{
+        &:focus {
           outline: none;
           outline: none;
         }
         }
       }
       }
@@ -443,9 +446,9 @@ body {
 }
 }
 .doc-cont {
 .doc-cont {
   padding: 8px 40px 8px 0;
   padding: 8px 40px 8px 0;
-  margin-left:50px;
+  margin-left: 50px;
   box-sizing: border-box;
   box-sizing: border-box;
-  flex:1;
+  flex: 1;
   min-width: 500px;
   min-width: 500px;
 }
 }
 // .button-primary {
 // .button-primary {
@@ -471,22 +474,22 @@ body {
 //   background-color: #33c3f0;
 //   background-color: #33c3f0;
 //   border-color: #33c3f0;
 //   border-color: #33c3f0;
 // }
 // }
-.demoLink{
+.demoLink {
   background: #fff;
   background: #fff;
   position: relative;
   position: relative;
   z-index: 99999;
   z-index: 99999;
   width: auto;
   width: auto;
   height: auto;
   height: auto;
-  a{
+  a {
     z-index: 9999;
     z-index: 9999;
   }
   }
-  &.qrcode{
-    span{
+  &.qrcode {
+    span {
       line-height: 64px;
       line-height: 64px;
     }
     }
-    img{
-      width:150px;
-      height:150px;
+    img {
+      width: 150px;
+      height: 150px;
     }
     }
   }
   }
 }
 }

+ 1 - 1
sites/doc/index.html

@@ -4,7 +4,7 @@
 <head>
 <head>
   <meta charset="utf-8" />
   <meta charset="utf-8" />
   <meta content="telephone=no" name="format-detection" />
   <meta content="telephone=no" name="format-detection" />
-
+  <link rel="shortcut icon" href="/favicon.ico">
   <title>NutUI 2.0 - 一款轻量级移动端Vue组件库</title>
   <title>NutUI 2.0 - 一款轻量级移动端Vue组件库</title>
   <script src="//misc.360buyimg.com/felibs/vue/2.5.16/vue.min.js"></script>
   <script src="//misc.360buyimg.com/felibs/vue/2.5.16/vue.min.js"></script>
 </head>
 </head>