Browse Source

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

Frans 6 years ago
parent
commit
1902d9f6a3

+ 2 - 0
package.json

@@ -15,6 +15,7 @@
     "dev:demo": "cross-env NODE_ENV=development webpack-dev-server -d --open --progress --config build/webpack.demo.dev.conf.js",
     "build:demo": "cross-env NODE_ENV=production webpack --hide-modules --progress --config build/webpack.demo.build.conf.js",
     "dev:doc": "cross-env NODE_ENV=development webpack-dev-server -d --open -w --progress --config build/webpack.doc.dev.conf.js",
+    "dev:clear":"node scripts/clearcache.js",
     "dev": "npm run dev:demo",
     "dev:carefree": "cross-env NODE_ENV=carefree carefree_env=dev webpack -w --colors --progress --config build/webpack.demo.dev.conf.js",
     "build:doc": "cross-env NODE_ENV=production webpack --hide-modules --progress --config build/webpack.doc.build.conf.js",
@@ -103,6 +104,7 @@
     "mocha": "5.2.0",
     "mocha-webpack": "2.0.0-beta.0",
     "moment": "2.22.2",
+    "node-filelist": "^1.0.0",
     "node-notifier": "5.2.1",
     "node-sass": "4.9.3",
     "nyc": "10.0.0",

+ 5 - 0
scripts/clearcache.js

@@ -0,0 +1,5 @@
+const fs = require('fs');
+const path = require('path');
+fs.writeFileSync(path.join(__dirname,'./localdocs.cache'),"",'utf-8');
+fs.writeFileSync(path.join(__dirname,'./localsrc.cache'),"",'utf-8');
+console.log("缓存清除成功")

+ 10 - 42
scripts/mdToVue.js

@@ -7,6 +7,7 @@ let marked = require('marked');
 if (!marked) {
     console.log('you need npm i marked -D!');
 }
+var nodeFilelist  = require('node-filelist');
 //文件监听
 let Chokidar = require('chokidar');
 // 基本配置文件信息
@@ -261,8 +262,7 @@ function comparehash(path,callback){
         .catch(error => {
             return console.error('hashing failed:', error);
         }); 
-    })
-     
+    })     
 }
 //文件监听
 function filelisten(param){  
@@ -290,21 +290,18 @@ function filelisten(param){
  */
 function fileDisplay(param) {
     //检查文件是否第一次初始化并获取hash
-    comparehash(param.entry,(hashMsgObj)=>{
-                
-        // 获取目录下所有文件
-        readDirRecur(param.entry, function(filePath) {    
-            //文件列表        
-            fileList.map(item=>{              
+    comparehash(param.entry,(hashMsgObj)=>{ 
+        nodeFilelist.read([param.entry],{"ext":"md"},res=>{    
+            let reslength = res.length;    
+            let routers = [];            
+            res.map((item,index)=>{   //数组化文件   
                 ismd(item,hashMsgObj,res=>{
                     //res md文件处理结果           
                     createdFile(param.output + res.mdName + '.vue', res.html, param)
                 })
-            })    
-        });
-    });
-   
-    
+            })     
+        })
+    });  
 }
 
 /**
@@ -326,35 +323,6 @@ function ishasOutFile(outPath,callback){
         }
     })
 }
-// function checkLoacl(){
-//     var selfFile = './scripts/mdToVue.js';
-//     //获取文件内容
-       
-//     checkIsexists(selfFile,(fileName)=>{
-//         let fileText = fs.readFileSync(fileName,'utf-8');  
-//     })
-//     //检查本文件是否被改动
-//     hashElement('./scripts/mdToVue.js').then(hash => {           
-//         if(fileText){
-//             //如果有内容
-//             callback({
-//                 fileText:fileText,
-//                 cachePath:cachePath
-//             })
-//         }else{
-//             pushHash(hash)               
-//             fs.writeFileSync(cachePath,outhash.join('|'),'utf-8');
-//             //如果没有内容
-//             callback({
-//                 fileText:fileText,
-//                 cachePath:cachePath
-//             })
-//         }
-//     })
-//     .catch(error => {
-//         return console.error('hashing failed:', error);
-//     }); 
-// }
 /**
  * 
  * @param {entry} 文件读取路径 

+ 2 - 0
src/packages/datepicker/datepicker.scss

@@ -0,0 +1,2 @@
+@import "../actionsheet/actionsheet.scss";
+@import "../picker/picker.scss";

+ 1 - 1
src/packages/stepper/__test__/stepper.spec.js

@@ -18,7 +18,7 @@ describe('Stepper.vue', () => {
         });
         const input = wraper.find('input');
         expect(wraper.contains('.nut-stepper-grey')).toBe(true);
-        expect(input.attributes('min')).toBe(minVal);
+        expect(input.attributes('min')).toBe('0');
         expect(input.attributes('max')).toBe(maxVal);
     });
 

+ 2 - 2
src/packages/stepper/stepper.vue

@@ -124,7 +124,7 @@ export default {
             const v = this.num;
             this.tempNum = v;
             this.minNum = '';
-            this.num = '';
+            // this.num = '';
             this.focusing = true;
         },
         blur(e) {
@@ -142,7 +142,7 @@ export default {
         },
         checknum(e) {
             let v = e.target.value;
-            this.minNum = this.min;
+            // this.minNum = this.min;
             this.focusing = false;
             if(v > this.max) v = this.max;
             if(v < this.minNum) v = this.minNum;