Browse Source

Merge branch 'v2' of https://github.com/jdf2e/nutui into v2

wangnan 7 years ago
parent
commit
65695765c3
6 changed files with 83 additions and 72 deletions
  1. 3 4
      .travis.yml
  2. 3 1
      package.json
  3. 1 1
      scripts/md-to-other.js
  4. 2 2
      sites/doc/app.vue
  5. 3 3
      sites/doc/index.vue
  6. 71 61
      sites/doc/search.vue

+ 3 - 4
.travis.yml

@@ -2,8 +2,7 @@ sudo: required
 language: node_js
 node_js:
   - '8'
+cache: npm
 script:
-  - 'npm run test'
-before_script:
-  - 'sudo chown root /opt/google/chrome/chrome-sandbox'
-  - 'sudo chmod 4755 /opt/google/chrome/chrome-sandbox'
+  - npm run test
+  - npm run coveralls

+ 3 - 1
package.json

@@ -24,7 +24,8 @@
     "build": "npm run build:prod && npm run build:prodmin && npm run build:disp",
     "eslint": "eslint src/packages/**/*.{js,vue}",
     "add": "node scripts/createCptTpl.js",
-    "test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha-webpack --webpack-config build/webpack.test.conf.js --require test/setup.js src/packages/*/__test__/**.spec.js"
+    "test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha-webpack --webpack-config build/webpack.test.conf.js --require test/setup.js src/packages/*/__test__/**.spec.js",
+    "coveralls": "cat ./coverage/lcov.info | coveralls"
   },
   "repository": {
     "type": "git",
@@ -78,6 +79,7 @@
     "chalk": "2.4.1",
     "copy": "0.3.2",
     "copy-webpack-plugin": "4.5.4",
+    "coveralls": "^3.0.2",
     "cross-env": "5.2.0",
     "css-loader": "1.0.0",
     "eslint": "4.19.1",

+ 1 - 1
scripts/md-to-other.js

@@ -101,7 +101,7 @@ function createdFile(output, sorce,ishasCode) {
         if( typeof fd  == 'number'){
             fs.writeSync(fd, buf, 0, buf.length, 0);
          }else{
-             console.log(pathSrc,'有问题')
+             console.log(pathSrc,' typeof fd != number 请改正文件')
          }
        
     })

+ 2 - 2
sites/doc/app.vue

@@ -6,13 +6,13 @@
   <div class="md-swaper" @click="clearSearch" v-else>
     <div class="hder">
       <div class="logo">
-        <a href="default.html#/index" class="logo-link"><img src="./asset/css/i/nut.png" alt></a> <span class="version">{{version}}</span>
+        <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="default.html#/doc">指南</a>
+            <a href="#/doc">指南</a>
           </li>        
           <li>
             <a class="qrcode demoLink" href="/demo.html#/index" target="_blank">示例             

+ 3 - 3
sites/doc/index.vue

@@ -34,10 +34,10 @@
           <div class="menu">
             <ul>
               <li>
-                <a href="default.html#/doc">指南</a>
+                <a href="#/doc">指南</a>
               </li>
               <li>
-                <a href="default.html#/ActionSheet">组件</a>
+                <a href="#/ActionSheet">组件</a>
               </li>
               <li>
                 <a href="/demo.html#/index" class="qrcode top-qr" target="_blank">示例
@@ -62,7 +62,7 @@
           <div class="mouseDiv" id="mouseDiv"></div>
           <p class="title">NutUI</p>
           <p class="sub-title">一套轻量级移动端Vue / 微信小程序组件库</p>
-          <a href="default.html#/doc" class="blue-btn">开始使用</a>
+          <a href="#/doc" class="blue-btn">开始使用</a>
           <a href="javascript:;" class="qrcode btn">
             扫码体验
             <a>

+ 71 - 61
sites/doc/search.vue

@@ -33,70 +33,80 @@ export default {
              searchIndex:0,
         }
     },   
+    mounted() {
+      let list = document.querySelector('.search-list');
+      let that = this;
+      window.addEventListener('click',that.closelist)
+    },
     methods:{
+        closelist(){           
+            this.searchList = [];
+            this.searchCurName='';
+            this.searchIndex=0;          
+        },
         onfocus(e) {
-      e.target.select();
-    },
-    clearSearch() {
-      this.searchList = [];
-    },
-    search(e) {
-      let val = e.target.value.toLowerCase();     
-       this.searchIndex=0;
-      if (val) {
-        let packages = this.packages;
-        let list = [];
-        for (let i = 0, item; (item = packages[i]); i++) {
-          let cn = item.chnName.toLowerCase();
-          let en = item.name.toLowerCase();
-          if (cn.indexOf(val) > -1 || en.indexOf(val) > -1) {
-            list.push(item);
-          }
-        }
-        this.searchList = list;
-      }else{
+            e.target.select();
+          },
+          clearSearch() {
+            this.searchList = [];
+          },    
+          search(e) {
+            let val = e.target.value.toLowerCase();     
+            this.searchIndex=0;
+            if (val) {
+              let packages = this.packages;
+              let list = [];
+              for (let i = 0, item; (item = packages[i]); i++) {
+                let cn = item.chnName.toLowerCase();
+                let en = item.name.toLowerCase();
+                if (cn.indexOf(val) > -1 || en.indexOf(val) > -1) {
+                  list.push(item);
+                }
+              }
+              this.searchList = list;
+            }else{
 
-           this.checklist()
-      }
-    },
-     checklist() {
-      this.searchVal = "";
-      this.searchList = [];
-      this.searchCurName='';
-      this.searchIndex=0;
-    },
-    choseList(e){
-      console.log(e)
-      let searchIndex = this.searchIndex;
-      if(e.keyCode==40){
-        searchIndex++;
-      }
-      if(e.keyCode==38){
-         searchIndex--;
-      }
-      if(searchIndex<0){
-        searchIndex = 0;
-      }      
-      let searchList = this.searchList;
-      if(searchList.length>0){       
-           console.log(searchList[searchIndex])
-       let chnName = searchList[searchIndex].name;
-      
-       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='';
-        }
-       }       
-      }
-    },
+                this.checklist()
+            }
+          },
+          checklist() {
+            this.searchVal = "";
+            this.searchList = [];
+            this.searchCurName='';
+            this.searchIndex=0;
+          },
+          choseList(e){
+            console.log(e)
+            let searchIndex = this.searchIndex;
+            if(e.keyCode==40){
+              searchIndex++;
+            }
+            if(e.keyCode==38){
+              searchIndex--;
+            }
+            if(searchIndex<0){
+              searchIndex = 0;
+            }      
+            let searchList = this.searchList;
+            if(searchList.length>0){       
+                console.log(searchList[searchIndex])
+            let chnName = searchList[searchIndex].name;
+            
+            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='';
+              }
+            }       
+            }
+          }
     }
 }
 </script>