Browse Source

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

Drjingfubo 5 years ago
parent
commit
cda2b91860
7 changed files with 164 additions and 42 deletions
  1. 2 0
      .npmrc
  2. 13 0
      .versionrc.json
  3. 15 0
      CHANGELOG.md
  4. 10 3
      package.json
  5. 60 0
      scripts/updateChangelog.js
  6. 4 4
      src/packages/swiper/demo.vue
  7. 60 35
      src/packages/swiper/doc.md

+ 2 - 0
.npmrc

@@ -0,0 +1,2 @@
+registry=https://registry.npmjs.org
+engine-strict=true

+ 13 - 0
.versionrc.json

@@ -0,0 +1,13 @@
+{
+  "header": "",
+  "types": [
+    { "type": "feat", "section": "feat" },
+    { "type": "fix", "section": "fix" },
+    { "type": "chore", "section": "chore" },
+    { "type": "docs", "section": "docs" },
+    { "type": "style", "section": "style" },
+    { "type": "refactor", "section": "refactor" },
+    { "type": "perf", "section": "perf" },
+    { "type": "test", "section": "test" }
+  ]
+}

+ 15 - 0
CHANGELOG.md

@@ -1,3 +1,18 @@
+## 2.2.14
+
+`2020-02-08`
+
+* :sparkles: feat(luckcard):增加支持刮开系数,支持清空蒙层 #365 @guoxiao158
+* :sparkles: feat(swiper):支持异步切换指定页数 #380 @ZXHHHH123、@jacob-zch、@richard1015
+* :sparkles: feat(calendar):添加 choose-click事件 #363 @richard1015
+* :bug: fix(tab):修复默认值def-index设置后不能自动将对应标题居中 #362 @zhenyulei
+* :bug: fix(collapse):优化折叠面板change回调方法 @Ymm0008
+* :bug: fix(upload):修复Android手机多次点击重复调用相机、相册兼容问题 #379 @Drjingfubo
+* :bug: fix(circleprogress):修复环形进度条渲染高亮问题 #373 @Drjingfubo、@layman666
+* :bug: fix(popup):修复挂载节点api无效的问题 #382 @yangkaixuan
+* :zap: calendar 文档修改 isOpenRangeSelect、endDate参数修改 @Drjingfubo 
+* :zap: actionsheet 文档修改 @click.native demo使用方法 @Drjingfubo 
+
 ## 2.2.13
 
 `2020-12-18`

+ 10 - 3
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@nutui/nutui",
-  "version": "2.2.13",
+  "version": "2.2.14",
   "description": "一套轻量级移动端Vue组件库",
   "typings": "dist/types/index.d.ts",
   "main": "dist/nutui.js",
@@ -14,6 +14,7 @@
   "scripts": {
     "dev": "nutui-cli dev",
     "build": "nutui-cli build",
+    "release": "standard-version -a",
     "build:site": "nutui-cli build-site",
     "clean": "nutui-cli clean",
     "add": "nutui-cli add",
@@ -34,6 +35,11 @@
     "type": "git",
     "url": "https://github.com/jdf2e/nutui.git"
   },
+  "standard-version": {
+    "scripts": {
+      "postchangelog": "node ./scripts/updateChangelog.js"
+    }
+  },
   "keywords": [
     "nutui",
     "nutui2",
@@ -56,6 +62,7 @@
     "babel-plugin-istanbul": "^6.0.0",
     "gsap": "^3.2.6",
     "hammerjs": "^2.0.8",
+    "standard-version": "^9.1.0",
     "vue-lazyload": "^1.3.3",
     "vue-qr": "^2.2.1"
   },
@@ -65,14 +72,14 @@
   "devDependencies": {
     "@babel/plugin-syntax-dynamic-import": "^7.8.3",
     "@babel/plugin-transform-object-assign": "^7.8.3",
-    "@nutui/cli": "^0.3.9",
+    "@nutui/cli": "^0.4.0",
     "@typescript-eslint/eslint-plugin": "^2.16.0",
     "@typescript-eslint/parser": "^2.16.0",
     "babel-plugin-transform-object-rest-spread": "^6.26.0",
     "eslint-plugin-import": "^2.20.0",
     "eslint-plugin-vue": "^6.1.2",
-    "lint-staged": "^10.2.11",
     "husky": "^3.0.0",
+    "lint-staged": "^10.2.11",
     "stylelint-config-standard": "^19.0.0"
   },
   "nyc": {

+ 60 - 0
scripts/updateChangelog.js

@@ -0,0 +1,60 @@
+const fs = require('fs');
+const path = require('path');
+const changelog = fs.readFileSync(path.join(__dirname, '../CHANGELOG.md'), 'utf8');
+const typeList = [
+  { type: 'fix', icon: '🐛' },
+  { type: 'feat', icon: '✨' },
+  { type: 'chore', icon: '👷' },
+  { type: 'docs', icon: '📝 ' },
+  { type: 'style', icon: '💄' },
+  { type: 'refactor', icon: '🎨' },
+  { type: 'perf', icon: '⚡' },
+  { type: 'test', icon: '✅ ' }
+];
+const replaceMd = {
+  content: '',
+  setContent(content) {
+    replaceMd.content = content;
+    return replaceMd;
+  },
+  getContent() {
+    return replaceMd.content;
+  },
+  //版本号改成二级标题
+  changeTitle() {
+    replaceMd.content = replaceMd.content.replace(/### (?=\[\d\.\d\.\d\])/g, '## ');
+    return replaceMd;
+  },
+  //修改日期位置
+  changeDate() {
+    replaceMd.content = replaceMd.content.replace(/(?<=\[\d\.\d\.\d\]\([\s\S]+\)) \((\d\d\d\d\-\d\d\-\d\d)\)(?=\n)/g, '\n`$1`');
+    return replaceMd;
+  },
+  //增加type内容
+  changeType() {
+    function replaceType(type, icon) {
+      replaceMd.content = replaceMd.content.replace(new RegExp(`(?<=### ${type}\\n\\n)\\* ([\\s\\S]+?)\\n+(?=[###|##])`, 'g'), function(match) {
+        return match.replace(new RegExp(`\\* ([\\s\\S]+?)(?=\\n)`, 'g'), `* ${icon} ${type}: $1`);
+      });
+    }
+    typeList.forEach(e => {
+      replaceType(e.type, e.icon);
+    });
+    return replaceMd;
+  },
+  //删除type标题
+  deleteType() {
+    typeList.forEach(e => {
+      replaceMd.content = replaceMd.content.replace(new RegExp(`### ${e.type}\\n+`, 'g'), '');
+    });
+    return replaceMd;
+  }
+};
+
+const newChangelog = replaceMd
+  .setContent(changelog)
+  .changeTitle()
+  .changeDate()
+  .changeType()
+  .deleteType();
+fs.writeFileSync(path.join(__dirname, '../CHANGELOG.md'), newChangelog.getContent(), 'utf8');

+ 4 - 4
src/packages/swiper/demo.vue

@@ -28,9 +28,9 @@
         <img :src="item.imgSrc" style="max-width:100%;" />
       </div>
     </nut-swiper>
-
-    <div @click="add">下翻页</div>
-    <div @click="sub">上翻页</div>
+    <br />
+    <nut-button @click="add">控制下翻页</nut-button>
+    <nut-button @click="sub">控制上翻页</nut-button>
 
     <h4>纵向自动播放</h4>
     <nut-swiper direction="vertical" :autoPlay="3000" :swiperData="dataImgItem">
@@ -109,7 +109,7 @@ export default {
       console.log(page);
     },
     add() {
-      this.newCurrentPage = this.newCurrentPage + 2;
+      this.newCurrentPage = this.newCurrentPage + 1;
     },
     sub() {
       this.newCurrentPage = this.newCurrentPage - 1;

+ 60 - 35
src/packages/swiper/doc.md

@@ -59,6 +59,9 @@
         <span>page 4</span>
     </div>
 </nut-swiper>
+<br/>
+<nut-button @click="add">控制下翻页</nut-button>
+<nut-button @click="sub">控制上翻页</nut-button>
 ```
 
 纵向自动播放
@@ -102,43 +105,65 @@
 ```
 
 ```javascript
-    export default{
-        data(){
-            return{
-                dataItem:[],
-                dataImgItem:[],
-            }
+export default {
+  data() {
+    return {
+      dataItem: [],
+      dataImgItem: [],
+      newCurrentPage: 1
+    };
+  },
+  mounted() {
+    setTimeout(() => {
+      this.dataItem = [
+        {
+          name: 1
         },
-        mounted(){
-            setTimeout(()=>{
-                this.dataItem = [{
-                    name:1
-                },{
-                    name:2
-                },{
-                    name:3
-                },{
-                    name:4
-                }]
-
-                this.dataImgItem = [
-                    {
-                        imgSrc:'//m.360buyimg.com/mobilecms/s843x843_jfs/t19441/80/1577112624/568821/1ee9b683/5ad064f1Nf41a94b4.jpg'
-                    },
-                    {
-                        imgSrc:'//m.360buyimg.com/mobilecms/s843x843_jfs/t16798/338/1617130854/542623/4c197f4d/5ad064f1Nce5f69e2.jpg'
-                    },
-                    {
-                        imgSrc:'//m.360buyimg.com/mobilecms/s843x843_jfs/t22123/348/720079801/233727/23c4c0a4/5b162d64Nc5883413.jpg'
-                    },
-                    {
-                        imgSrc:'//m.360buyimg.com/mobilecms/s843x843_jfs/t1/27233/9/354/82863/5c090a0eEe2a350d8/aaa6686ce133e364.jpg'
-                    }
-                ];
-            },300)
+        {
+          name: 2
+        },
+        {
+          name: 3
+        },
+        {
+          name: 4
         }
-    }
+      ];
 
+      this.dataImgItem = [
+        {
+          imgSrc: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/18629/34/3378/144318/5c263f64Ef0e2bff0/0d650e0aa2e852ee.jpg'
+        },
+        {
+          imgSrc: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/26597/30/4870/174583/5c35c5d2Ed55eedc6/50e27870c25e7a82.png'
+        },
+        {
+          imgSrc: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/9542/17/12873/201687/5c3c4362Ea9eb757d/60026b40a9d60d85.jpg'
+        },
+        {
+          imgSrc: '//m.360buyimg.com/mobilecms/s750x366_jfs/t1/30042/36/427/82951/5c3bfdabE3faf2f66/9adca782661c988c.jpg'
+        }
+      ];
+    }, 300);
+  },
+  methods: {
+    slideChangeEnd(page) {
+      console.log(page);
+    },
+    slideMove(page) {
+      console.log(page);
+    },
+    slideChangeStart(page) {
+      console.log(page);
+    },
+    add() {
+      this.newCurrentPage = this.newCurrentPage + 1;
+    },
+    sub() {
+      this.newCurrentPage = this.newCurrentPage - 1;
+    }
+  }
+};
 ```
 
 ## Prop
@@ -156,7 +181,7 @@
 | lazyLoad | 是否懒加载图片 | Boolean | false
 | lazyLoadUrl | 懒加载的默认展示图片 | String | -
 | swiperData | 异步数据渲染slide时,必须绑定对应数组(v2.1.7以上支持) | Array | -
-
+| newCurrentPage | 当前页数控制,用于异步切换指定页数(v2.2.14以上支持) | Number | 1
 ## Methods
 
 | 字段 | 说明 | 参数