From a305a44fcc1db03aacd43cc2cff67d283acaead0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=94=E5=AD=90?= Date: Tue, 16 Feb 2021 13:33:32 +0800 Subject: [PATCH 01/15] =?UTF-8?q?perf(Popup):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/popup/index.js | 36 +++++++++++++++++++----------------- src/popup/index.less | 19 +++++-------------- src/popup/index.wxml | 5 ++--- 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/popup/index.js b/src/popup/index.js index 4ebf2b3..098fd39 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -56,7 +56,18 @@ Component({ * 组件的初始数据 */ data: { - status: 'show' + status: 'hide' + }, + + observers: { + show(show) { + if (show) { + this.setData({ + status: 'show' + }); + } + + } }, /** @@ -101,27 +112,18 @@ Component({ // 点击事件 onPopupTap() { - let detail = true; if (this.data.locked !== true) { - if (!this.data.show) { - this.setData({ - show: true, - status: 'show' - }); - } else { + this.setData({ + status: 'hide' + }); + setTimeout(() => { this.setData({ - status: 'hide' + show: false }); - setTimeout(() => { - this.setData({ - show: false, - status: 'show' - }); - }, 300); - } + }, 300); } - eventUtil.emit(this,'lintap', detail); + eventUtil.emit(this, 'lintap'); } } }); diff --git a/src/popup/index.less b/src/popup/index.less index 3b55fb5..e7b1b60 100644 --- a/src/popup/index.less +++ b/src/popup/index.less @@ -78,7 +78,6 @@ each(@animationPostions,{ } .container-popup { - visibility: hidden; position: fixed; top: 0; left: 0; @@ -86,17 +85,16 @@ each(@animationPostions,{ bottom: 0; } -.popup-show { - visibility: visible; +.container-bg-show { + opacity: 1; } -.popup-show .container-bg { - display: block; - opacity: 1; +.container-bg-hide { + opacity: 0; } .container-bg { - opacity: 0; + display: block; position: fixed; top: 0; left: 0; @@ -107,13 +105,6 @@ each(@animationPostions,{ transition: all 0.3s ease-in-out; } -.popup-bg { - height: 100%; - width: 100%; - position: absolute; - z-index: 90; -} - .popup-content { position: absolute; z-index: 100; diff --git a/src/popup/index.wxml b/src/popup/index.wxml index c56ed1e..f500052 100644 --- a/src/popup/index.wxml +++ b/src/popup/index.wxml @@ -1,9 +1,8 @@ - - + -- Gitee From 75d365b62288a72be2ebbdc6839ef24e6846e034 Mon Sep 17 00:00:00 2001 From: Juzi Date: Tue, 16 Feb 2021 13:43:27 +0800 Subject: [PATCH 02/15] build: Travis CI automatic compilation --- dist/popup/index.js | 2 +- dist/popup/index.wxml | 6 +++--- dist/popup/index.wxss | 2 +- examples/dist/popup/index.js | 36 ++++++++++++++++++---------------- examples/dist/popup/index.wxml | 5 ++--- examples/dist/popup/index.wxss | 2 +- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/dist/popup/index.js b/dist/popup/index.js index 7dbb14a..1307485 100644 --- a/dist/popup/index.js +++ b/dist/popup/index.js @@ -1 +1 @@ -import zIndex from"../behaviors/zIndex";import validator from"../behaviors/validator";import eventUtil from"../core/utils/event-util";Component({behaviors:[zIndex,validator],externalClasses:["l-bg-class","l-panel-class","l-class"],properties:{show:{type:Boolean,value:!1},animation:{type:Boolean,value:!0},transition:{type:Boolean,value:null},contentAlign:{type:String,value:"center",options:["top","right","left","bottom","center"]},direction:{type:String,value:null,options:["top","right","left","bottom","center"]},locked:{type:Boolean,value:!1}},attached(){this._init()},pageLifetimes:{show(){this._init()}},data:{status:"show"},methods:{_init(){wx.lin=wx.lin||{},wx.lin.showPopup=t=>{const{zIndex:e=99,animation:o=!0,contentAlign:i="center",locked:a=!1}={...t};this.setData({zIndex:e,animation:o,contentAlign:i,locked:a,show:!0})},wx.lin.hidePopup=()=>{this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)}},doNothingMove(){},doNothingTap(){},onPopupTap(){!0!==this.data.locked&&(this.data.show?(this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1,status:"show"})},300)):this.setData({show:!0,status:"show"})),eventUtil.emit(this,"lintap",!0)}}}); \ No newline at end of file +import zIndex from"../behaviors/zIndex";import validator from"../behaviors/validator";import eventUtil from"../core/utils/event-util";Component({behaviors:[zIndex,validator],externalClasses:["l-bg-class","l-panel-class","l-class"],properties:{show:{type:Boolean,value:!1},animation:{type:Boolean,value:!0},transition:{type:Boolean,value:null},contentAlign:{type:String,value:"center",options:["top","right","left","bottom","center"]},direction:{type:String,value:null,options:["top","right","left","bottom","center"]},locked:{type:Boolean,value:!1}},attached(){this._init()},pageLifetimes:{show(){this._init()}},data:{status:"hide"},observers:{show(t){t&&this.setData({status:"show"})}},methods:{_init(){wx.lin=wx.lin||{},wx.lin.showPopup=t=>{const{zIndex:e=99,animation:o=!0,contentAlign:i="center",locked:a=!1}={...t};this.setData({zIndex:e,animation:o,contentAlign:i,locked:a,show:!0})},wx.lin.hidePopup=()=>{this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)}},doNothingMove(){},doNothingTap(){},onPopupTap(){!0!==this.data.locked&&(this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)),eventUtil.emit(this,"lintap")}}}); \ No newline at end of file diff --git a/dist/popup/index.wxml b/dist/popup/index.wxml index e075328..84756c2 100644 --- a/dist/popup/index.wxml +++ b/dist/popup/index.wxml @@ -1,6 +1,6 @@ - - - + + + diff --git a/dist/popup/index.wxss b/dist/popup/index.wxss index 1d80b77..f228b27 100644 --- a/dist/popup/index.wxss +++ b/dist/popup/index.wxss @@ -1 +1 @@ -.popup-fade-center-active-show{animation:popup-center-fadein .3s forwards}.popup-fade-center-active-hide{animation:popup-center-fadeout .3s forwards}.popup-fade-top-active-show{animation:popup-top-fadein .3s forwards}.popup-fade-top-active-hide{animation:popup-top-fadeout .3s forwards}.popup-fade-left-active-show{animation:popup-left-fadein .3s forwards}.popup-fade-left-active-hide{animation:popup-left-fadeout .3s forwards}.popup-fade-right-active-show{animation:popup-right-fadein .3s forwards}.popup-fade-right-active-hide{animation:popup-right-fadeout .3s forwards}.popup-fade-bottom-active-show{animation:popup-bottom-fadein .3s forwards}.popup-fade-bottom-active-hide{animation:popup-bottom-fadeout .3s forwards}@keyframes popup-top-fadein{0%{transform:translate3d(0,-100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-top-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,-100%,0);opacity:.1}}@keyframes popup-left-fadein{0%{transform:translate3d(-100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-left-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(-100%,0,0);opacity:.1}}@keyframes popup-right-fadein{0%{transform:translate3d(100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-right-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(100%,0,0);opacity:.1}}@keyframes popup-bottom-fadein{0%{transform:translate3d(0,100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-bottom-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,100%,0);opacity:.1}}@keyframes popup-center-fadein{0%{transform:scale(.8);opacity:0}50%{transform:scale(1.1)}100%{transform:scale(1);opacity:1}}@keyframes popup-center-fadeout{0%{transform:scale(1);opacity:1}50%{transform:scale(1.1)}100%{transform:scale(.8);opacity:0}}.container-popup{visibility:hidden;position:fixed;top:0;left:0;right:0;bottom:0}.popup-show{visibility:visible}.popup-show .container-bg{display:block;opacity:1}.container-bg{opacity:0;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.4);transition:all .3s ease-in-out}.popup-bg{height:100%;width:100%;position:absolute;z-index:90}.popup-content{position:absolute;z-index:100;width:100%;max-width:100%;height:100%}.center{display:flex;height:100%;width:100%;flex-direction:row;align-items:center;justify-content:center}.left{display:flex;flex-direction:row;height:100%}.right{display:flex;flex-direction:row;justify-content:flex-end;height:100%}.bottom{display:flex;flex-direction:column-reverse;width:100%} \ No newline at end of file +.popup-fade-center-active-show{animation:popup-center-fadein .3s forwards}.popup-fade-center-active-hide{animation:popup-center-fadeout .3s forwards}.popup-fade-top-active-show{animation:popup-top-fadein .3s forwards}.popup-fade-top-active-hide{animation:popup-top-fadeout .3s forwards}.popup-fade-left-active-show{animation:popup-left-fadein .3s forwards}.popup-fade-left-active-hide{animation:popup-left-fadeout .3s forwards}.popup-fade-right-active-show{animation:popup-right-fadein .3s forwards}.popup-fade-right-active-hide{animation:popup-right-fadeout .3s forwards}.popup-fade-bottom-active-show{animation:popup-bottom-fadein .3s forwards}.popup-fade-bottom-active-hide{animation:popup-bottom-fadeout .3s forwards}@keyframes popup-top-fadein{0%{transform:translate3d(0,-100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-top-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,-100%,0);opacity:.1}}@keyframes popup-left-fadein{0%{transform:translate3d(-100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-left-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(-100%,0,0);opacity:.1}}@keyframes popup-right-fadein{0%{transform:translate3d(100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-right-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(100%,0,0);opacity:.1}}@keyframes popup-bottom-fadein{0%{transform:translate3d(0,100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-bottom-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,100%,0);opacity:.1}}@keyframes popup-center-fadein{0%{transform:scale(.8);opacity:0}50%{transform:scale(1.1)}100%{transform:scale(1);opacity:1}}@keyframes popup-center-fadeout{0%{transform:scale(1);opacity:1}50%{transform:scale(1.1)}100%{transform:scale(.8);opacity:0}}.container-popup{position:fixed;top:0;left:0;right:0;bottom:0}.container-bg-show{opacity:1}.container-bg-hide{opacity:0}.container-bg{display:block;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.4);transition:all .3s ease-in-out}.popup-content{position:absolute;z-index:100;width:100%;max-width:100%;height:100%}.center{display:flex;height:100%;width:100%;flex-direction:row;align-items:center;justify-content:center}.left{display:flex;flex-direction:row;height:100%}.right{display:flex;flex-direction:row;justify-content:flex-end;height:100%}.bottom{display:flex;flex-direction:column-reverse;width:100%} \ No newline at end of file diff --git a/examples/dist/popup/index.js b/examples/dist/popup/index.js index 4ebf2b3..098fd39 100644 --- a/examples/dist/popup/index.js +++ b/examples/dist/popup/index.js @@ -56,7 +56,18 @@ Component({ * 组件的初始数据 */ data: { - status: 'show' + status: 'hide' + }, + + observers: { + show(show) { + if (show) { + this.setData({ + status: 'show' + }); + } + + } }, /** @@ -101,27 +112,18 @@ Component({ // 点击事件 onPopupTap() { - let detail = true; if (this.data.locked !== true) { - if (!this.data.show) { - this.setData({ - show: true, - status: 'show' - }); - } else { + this.setData({ + status: 'hide' + }); + setTimeout(() => { this.setData({ - status: 'hide' + show: false }); - setTimeout(() => { - this.setData({ - show: false, - status: 'show' - }); - }, 300); - } + }, 300); } - eventUtil.emit(this,'lintap', detail); + eventUtil.emit(this, 'lintap'); } } }); diff --git a/examples/dist/popup/index.wxml b/examples/dist/popup/index.wxml index c56ed1e..f500052 100644 --- a/examples/dist/popup/index.wxml +++ b/examples/dist/popup/index.wxml @@ -1,9 +1,8 @@ - - + diff --git a/examples/dist/popup/index.wxss b/examples/dist/popup/index.wxss index 1d80b77..f228b27 100644 --- a/examples/dist/popup/index.wxss +++ b/examples/dist/popup/index.wxss @@ -1 +1 @@ -.popup-fade-center-active-show{animation:popup-center-fadein .3s forwards}.popup-fade-center-active-hide{animation:popup-center-fadeout .3s forwards}.popup-fade-top-active-show{animation:popup-top-fadein .3s forwards}.popup-fade-top-active-hide{animation:popup-top-fadeout .3s forwards}.popup-fade-left-active-show{animation:popup-left-fadein .3s forwards}.popup-fade-left-active-hide{animation:popup-left-fadeout .3s forwards}.popup-fade-right-active-show{animation:popup-right-fadein .3s forwards}.popup-fade-right-active-hide{animation:popup-right-fadeout .3s forwards}.popup-fade-bottom-active-show{animation:popup-bottom-fadein .3s forwards}.popup-fade-bottom-active-hide{animation:popup-bottom-fadeout .3s forwards}@keyframes popup-top-fadein{0%{transform:translate3d(0,-100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-top-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,-100%,0);opacity:.1}}@keyframes popup-left-fadein{0%{transform:translate3d(-100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-left-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(-100%,0,0);opacity:.1}}@keyframes popup-right-fadein{0%{transform:translate3d(100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-right-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(100%,0,0);opacity:.1}}@keyframes popup-bottom-fadein{0%{transform:translate3d(0,100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-bottom-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,100%,0);opacity:.1}}@keyframes popup-center-fadein{0%{transform:scale(.8);opacity:0}50%{transform:scale(1.1)}100%{transform:scale(1);opacity:1}}@keyframes popup-center-fadeout{0%{transform:scale(1);opacity:1}50%{transform:scale(1.1)}100%{transform:scale(.8);opacity:0}}.container-popup{visibility:hidden;position:fixed;top:0;left:0;right:0;bottom:0}.popup-show{visibility:visible}.popup-show .container-bg{display:block;opacity:1}.container-bg{opacity:0;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.4);transition:all .3s ease-in-out}.popup-bg{height:100%;width:100%;position:absolute;z-index:90}.popup-content{position:absolute;z-index:100;width:100%;max-width:100%;height:100%}.center{display:flex;height:100%;width:100%;flex-direction:row;align-items:center;justify-content:center}.left{display:flex;flex-direction:row;height:100%}.right{display:flex;flex-direction:row;justify-content:flex-end;height:100%}.bottom{display:flex;flex-direction:column-reverse;width:100%} \ No newline at end of file +.popup-fade-center-active-show{animation:popup-center-fadein .3s forwards}.popup-fade-center-active-hide{animation:popup-center-fadeout .3s forwards}.popup-fade-top-active-show{animation:popup-top-fadein .3s forwards}.popup-fade-top-active-hide{animation:popup-top-fadeout .3s forwards}.popup-fade-left-active-show{animation:popup-left-fadein .3s forwards}.popup-fade-left-active-hide{animation:popup-left-fadeout .3s forwards}.popup-fade-right-active-show{animation:popup-right-fadein .3s forwards}.popup-fade-right-active-hide{animation:popup-right-fadeout .3s forwards}.popup-fade-bottom-active-show{animation:popup-bottom-fadein .3s forwards}.popup-fade-bottom-active-hide{animation:popup-bottom-fadeout .3s forwards}@keyframes popup-top-fadein{0%{transform:translate3d(0,-100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-top-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,-100%,0);opacity:.1}}@keyframes popup-left-fadein{0%{transform:translate3d(-100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-left-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(-100%,0,0);opacity:.1}}@keyframes popup-right-fadein{0%{transform:translate3d(100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-right-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(100%,0,0);opacity:.1}}@keyframes popup-bottom-fadein{0%{transform:translate3d(0,100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-bottom-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,100%,0);opacity:.1}}@keyframes popup-center-fadein{0%{transform:scale(.8);opacity:0}50%{transform:scale(1.1)}100%{transform:scale(1);opacity:1}}@keyframes popup-center-fadeout{0%{transform:scale(1);opacity:1}50%{transform:scale(1.1)}100%{transform:scale(.8);opacity:0}}.container-popup{position:fixed;top:0;left:0;right:0;bottom:0}.container-bg-show{opacity:1}.container-bg-hide{opacity:0}.container-bg{display:block;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.4);transition:all .3s ease-in-out}.popup-content{position:absolute;z-index:100;width:100%;max-width:100%;height:100%}.center{display:flex;height:100%;width:100%;flex-direction:row;align-items:center;justify-content:center}.left{display:flex;flex-direction:row;height:100%}.right{display:flex;flex-direction:row;justify-content:flex-end;height:100%}.bottom{display:flex;flex-direction:column-reverse;width:100%} \ No newline at end of file -- Gitee From 176169ebcf639dda0f62f62fd32a8a0b6d819f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=94=E5=AD=90?= Date: Tue, 16 Feb 2021 13:37:07 +0800 Subject: [PATCH 03/15] =?UTF-8?q?refactor(Popup):=20=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E9=98=BB=E6=AD=A2=E5=86=92=E6=B3=A1=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc | 3 ++- src/core/behaviors/doNothingBehavior.js | 8 ++++++++ src/popup/index.js | 10 ++-------- src/popup/index.wxml | 6 +++--- 4 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 src/core/behaviors/doNothingBehavior.js diff --git a/.eslintrc b/.eslintrc index fd84620..3f77ecd 100644 --- a/.eslintrc +++ b/.eslintrc @@ -24,7 +24,8 @@ "Page": true, "wx": true, "App": true, - "getCurrentPages":true + "getCurrentPages":true, + "Behavior": true }, "ignorePatterns": [ "dist/*", diff --git a/src/core/behaviors/doNothingBehavior.js b/src/core/behaviors/doNothingBehavior.js new file mode 100644 index 0000000..4796915 --- /dev/null +++ b/src/core/behaviors/doNothingBehavior.js @@ -0,0 +1,8 @@ +// 定义一个空内容函数,用于阻止事件冒泡 + +export default Behavior({ + methods: { + doNothing() { + } + } +}); diff --git a/src/popup/index.js b/src/popup/index.js index 098fd39..8b2e365 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -1,12 +1,13 @@ import zIndex from '../behaviors/zIndex'; import validator from '../behaviors/validator'; import eventUtil from '../core/utils/event-util'; +import doNothing from '../core/behaviors/doNothingBehavior'; Component({ /** * 组件的属性列表 */ - behaviors: [zIndex, validator], + behaviors: [zIndex, validator, doNothing], externalClasses: ['l-bg-class', 'l-panel-class', 'l-class'], properties: { // 显示与隐藏 @@ -102,13 +103,6 @@ Component({ }, 300); }; }, - // 阻止滑动 - doNothingMove() { - // do nothing…… - }, - doNothingTap() { - // do nathing - }, // 点击事件 onPopupTap() { diff --git a/src/popup/index.wxml b/src/popup/index.wxml index f500052..b6f1e12 100644 --- a/src/popup/index.wxml +++ b/src/popup/index.wxml @@ -1,11 +1,11 @@ + catchtouchmove="doNothing"> - + -- Gitee From 90c96a9b008e583b9de552f077b68ea2ae4ddae9 Mon Sep 17 00:00:00 2001 From: Juzi Date: Tue, 16 Feb 2021 14:21:09 +0800 Subject: [PATCH 04/15] build: Travis CI automatic compilation --- dist/core/behaviors/doNothingBehavior.js | 1 + dist/popup/index.js | 2 +- dist/popup/index.wxml | 6 +++--- examples/dist/core/behaviors/doNothingBehavior.js | 8 ++++++++ examples/dist/popup/index.js | 10 ++-------- examples/dist/popup/index.wxml | 6 +++--- 6 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 dist/core/behaviors/doNothingBehavior.js create mode 100644 examples/dist/core/behaviors/doNothingBehavior.js diff --git a/dist/core/behaviors/doNothingBehavior.js b/dist/core/behaviors/doNothingBehavior.js new file mode 100644 index 0000000..1a29b3e --- /dev/null +++ b/dist/core/behaviors/doNothingBehavior.js @@ -0,0 +1 @@ +export default Behavior({methods:{doNothing(){}}}); \ No newline at end of file diff --git a/dist/popup/index.js b/dist/popup/index.js index 1307485..ef5d111 100644 --- a/dist/popup/index.js +++ b/dist/popup/index.js @@ -1 +1 @@ -import zIndex from"../behaviors/zIndex";import validator from"../behaviors/validator";import eventUtil from"../core/utils/event-util";Component({behaviors:[zIndex,validator],externalClasses:["l-bg-class","l-panel-class","l-class"],properties:{show:{type:Boolean,value:!1},animation:{type:Boolean,value:!0},transition:{type:Boolean,value:null},contentAlign:{type:String,value:"center",options:["top","right","left","bottom","center"]},direction:{type:String,value:null,options:["top","right","left","bottom","center"]},locked:{type:Boolean,value:!1}},attached(){this._init()},pageLifetimes:{show(){this._init()}},data:{status:"hide"},observers:{show(t){t&&this.setData({status:"show"})}},methods:{_init(){wx.lin=wx.lin||{},wx.lin.showPopup=t=>{const{zIndex:e=99,animation:o=!0,contentAlign:i="center",locked:a=!1}={...t};this.setData({zIndex:e,animation:o,contentAlign:i,locked:a,show:!0})},wx.lin.hidePopup=()=>{this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)}},doNothingMove(){},doNothingTap(){},onPopupTap(){!0!==this.data.locked&&(this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)),eventUtil.emit(this,"lintap")}}}); \ No newline at end of file +import zIndex from"../behaviors/zIndex";import validator from"../behaviors/validator";import eventUtil from"../core/utils/event-util";import doNothing from"../core/behaviors/doNothingBehavior";Component({behaviors:[zIndex,validator,doNothing],externalClasses:["l-bg-class","l-panel-class","l-class"],properties:{show:{type:Boolean,value:!1},animation:{type:Boolean,value:!0},transition:{type:Boolean,value:null},contentAlign:{type:String,value:"center",options:["top","right","left","bottom","center"]},direction:{type:String,value:null,options:["top","right","left","bottom","center"]},locked:{type:Boolean,value:!1}},attached(){this._init()},pageLifetimes:{show(){this._init()}},data:{status:"hide"},observers:{show(t){t&&this.setData({status:"show"})}},methods:{_init(){wx.lin=wx.lin||{},wx.lin.showPopup=t=>{const{zIndex:e=99,animation:o=!0,contentAlign:i="center",locked:a=!1}={...t};this.setData({zIndex:e,animation:o,contentAlign:i,locked:a,show:!0})},wx.lin.hidePopup=()=>{this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)}},onPopupTap(){!0!==this.data.locked&&(this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)),eventUtil.emit(this,"lintap")}}}); \ No newline at end of file diff --git a/dist/popup/index.wxml b/dist/popup/index.wxml index 84756c2..152af98 100644 --- a/dist/popup/index.wxml +++ b/dist/popup/index.wxml @@ -1,7 +1,7 @@ - + - - + + diff --git a/examples/dist/core/behaviors/doNothingBehavior.js b/examples/dist/core/behaviors/doNothingBehavior.js new file mode 100644 index 0000000..4796915 --- /dev/null +++ b/examples/dist/core/behaviors/doNothingBehavior.js @@ -0,0 +1,8 @@ +// 定义一个空内容函数,用于阻止事件冒泡 + +export default Behavior({ + methods: { + doNothing() { + } + } +}); diff --git a/examples/dist/popup/index.js b/examples/dist/popup/index.js index 098fd39..8b2e365 100644 --- a/examples/dist/popup/index.js +++ b/examples/dist/popup/index.js @@ -1,12 +1,13 @@ import zIndex from '../behaviors/zIndex'; import validator from '../behaviors/validator'; import eventUtil from '../core/utils/event-util'; +import doNothing from '../core/behaviors/doNothingBehavior'; Component({ /** * 组件的属性列表 */ - behaviors: [zIndex, validator], + behaviors: [zIndex, validator, doNothing], externalClasses: ['l-bg-class', 'l-panel-class', 'l-class'], properties: { // 显示与隐藏 @@ -102,13 +103,6 @@ Component({ }, 300); }; }, - // 阻止滑动 - doNothingMove() { - // do nothing…… - }, - doNothingTap() { - // do nathing - }, // 点击事件 onPopupTap() { diff --git a/examples/dist/popup/index.wxml b/examples/dist/popup/index.wxml index f500052..b6f1e12 100644 --- a/examples/dist/popup/index.wxml +++ b/examples/dist/popup/index.wxml @@ -1,11 +1,11 @@ + catchtouchmove="doNothing"> - + -- Gitee From 6ac70ca1a417ac44cd4f03e1af4ca35127a25193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=94=E5=AD=90?= Date: Tue, 16 Feb 2021 16:31:36 +0800 Subject: [PATCH 05/15] =?UTF-8?q?feat(Popup):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=BC=80=E6=94=BE=E5=87=BD=E6=95=B0=20linShow=20=E5=92=8C=20li?= =?UTF-8?q?nHide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/popup/index.js | 60 ++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/src/popup/index.js b/src/popup/index.js index 8b2e365..d22d990 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -78,29 +78,12 @@ Component({ _init() { wx.lin = wx.lin || {}; wx.lin.showPopup = (options) => { - const { - zIndex = 99, - animation = true, - contentAlign = 'center', - locked = false - } = {...options}; - this.setData({ - zIndex, - animation, - contentAlign, - locked, - show: true - }); + console.warn('wx.lin 方法已废弃,请使用开放函数代替 https://doc.mini.talelin.com/start/open-function.html'); + this.linShow(options); }; wx.lin.hidePopup = () => { - this.setData({ - status: 'hide' - }); - setTimeout(() => { - this.setData({ - show: false - }); - }, 300); + console.warn('wx.lin 方法已废弃,请使用开放函数代替 https://doc.mini.talelin.com/start/open-function.html'); + this.linHide(); }; }, @@ -118,6 +101,41 @@ Component({ } eventUtil.emit(this, 'lintap'); + }, + + // ================= 开放函数 ======================== + /** + * 显示 Popup + */ + linShow(options) { + const { + zIndex = 99, + animation = true, + contentAlign = 'center', + locked = false + } = {...options}; + this.setData({ + zIndex, + animation, + contentAlign, + locked, + show: true + }); + }, + + /** + * 隐藏 Popup + * 会忽略 locked 属性 + */ + linHide() { + this.setData({ + status: 'hide' + }); + setTimeout(() => { + this.setData({ + show: false + }); + }, 300); } } }); -- Gitee From acfb183a511b0edac4721ecbb99f505acf9a77d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=94=E5=AD=90?= Date: Tue, 16 Feb 2021 20:48:41 +0800 Subject: [PATCH 06/15] =?UTF-8?q?refactor(Popup):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=BB=91=E8=89=B2=E8=83=8C=E6=99=AF=E5=8A=A8=E7=94=BB=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/popup/index.js | 1 - src/popup/index.less | 25 ++++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/popup/index.js b/src/popup/index.js index d22d990..b6ca901 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -67,7 +67,6 @@ Component({ status: 'show' }); } - } }, diff --git a/src/popup/index.less b/src/popup/index.less index e7b1b60..d3b2f04 100644 --- a/src/popup/index.less +++ b/src/popup/index.less @@ -77,6 +77,26 @@ each(@animationPostions,{ } } +@keyframes bg-fadein { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + } +} + +@keyframes bg-fadeout { + 0% { + opacity: 1; + } + + 100% { + opacity: 0; + } +} + .container-popup { position: fixed; top: 0; @@ -86,11 +106,11 @@ each(@animationPostions,{ } .container-bg-show { - opacity: 1; + animation: bg-fadein 0.3s forwards; } .container-bg-hide { - opacity: 0; + animation: bg-fadeout 0.3s forwards; } .container-bg { @@ -102,7 +122,6 @@ each(@animationPostions,{ bottom: 0; z-index: 6; background: rgba(0, 0, 0, 0.4); - transition: all 0.3s ease-in-out; } .popup-content { -- Gitee From 3cd24897c02c42679a55c96fcf15e50e257cf227 Mon Sep 17 00:00:00 2001 From: Juzi Date: Tue, 16 Feb 2021 21:00:40 +0800 Subject: [PATCH 07/15] build: Travis CI automatic compilation --- dist/popup/index.js | 2 +- examples/dist/popup/index.js | 60 +++++++++++++++++++++++------------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/dist/popup/index.js b/dist/popup/index.js index ef5d111..23cb64b 100644 --- a/dist/popup/index.js +++ b/dist/popup/index.js @@ -1 +1 @@ -import zIndex from"../behaviors/zIndex";import validator from"../behaviors/validator";import eventUtil from"../core/utils/event-util";import doNothing from"../core/behaviors/doNothingBehavior";Component({behaviors:[zIndex,validator,doNothing],externalClasses:["l-bg-class","l-panel-class","l-class"],properties:{show:{type:Boolean,value:!1},animation:{type:Boolean,value:!0},transition:{type:Boolean,value:null},contentAlign:{type:String,value:"center",options:["top","right","left","bottom","center"]},direction:{type:String,value:null,options:["top","right","left","bottom","center"]},locked:{type:Boolean,value:!1}},attached(){this._init()},pageLifetimes:{show(){this._init()}},data:{status:"hide"},observers:{show(t){t&&this.setData({status:"show"})}},methods:{_init(){wx.lin=wx.lin||{},wx.lin.showPopup=t=>{const{zIndex:e=99,animation:o=!0,contentAlign:i="center",locked:a=!1}={...t};this.setData({zIndex:e,animation:o,contentAlign:i,locked:a,show:!0})},wx.lin.hidePopup=()=>{this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)}},onPopupTap(){!0!==this.data.locked&&(this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)),eventUtil.emit(this,"lintap")}}}); \ No newline at end of file +import zIndex from"../behaviors/zIndex";import validator from"../behaviors/validator";import eventUtil from"../core/utils/event-util";import doNothing from"../core/behaviors/doNothingBehavior";Component({behaviors:[zIndex,validator,doNothing],externalClasses:["l-bg-class","l-panel-class","l-class"],properties:{show:{type:Boolean,value:!1},animation:{type:Boolean,value:!0},transition:{type:Boolean,value:null},contentAlign:{type:String,value:"center",options:["top","right","left","bottom","center"]},direction:{type:String,value:null,options:["top","right","left","bottom","center"]},locked:{type:Boolean,value:!1}},attached(){this._init()},pageLifetimes:{show(){this._init()}},data:{status:"hide"},observers:{show(t){t&&this.setData({status:"show"})}},methods:{_init(){wx.lin=wx.lin||{},wx.lin.showPopup=t=>{console.warn("wx.lin 方法已废弃,请使用开放函数代替 https://doc.mini.talelin.com/start/open-function.html"),this.linShow(t)},wx.lin.hidePopup=()=>{console.warn("wx.lin 方法已废弃,请使用开放函数代替 https://doc.mini.talelin.com/start/open-function.html"),this.linHide()}},onPopupTap(){!0!==this.data.locked&&(this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)),eventUtil.emit(this,"lintap")},linShow(t){const{zIndex:e=99,animation:o=!0,contentAlign:i="center",locked:n=!1}={...t};this.setData({zIndex:e,animation:o,contentAlign:i,locked:n,show:!0})},linHide(){this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)}}}); \ No newline at end of file diff --git a/examples/dist/popup/index.js b/examples/dist/popup/index.js index 8b2e365..d22d990 100644 --- a/examples/dist/popup/index.js +++ b/examples/dist/popup/index.js @@ -78,29 +78,12 @@ Component({ _init() { wx.lin = wx.lin || {}; wx.lin.showPopup = (options) => { - const { - zIndex = 99, - animation = true, - contentAlign = 'center', - locked = false - } = {...options}; - this.setData({ - zIndex, - animation, - contentAlign, - locked, - show: true - }); + console.warn('wx.lin 方法已废弃,请使用开放函数代替 https://doc.mini.talelin.com/start/open-function.html'); + this.linShow(options); }; wx.lin.hidePopup = () => { - this.setData({ - status: 'hide' - }); - setTimeout(() => { - this.setData({ - show: false - }); - }, 300); + console.warn('wx.lin 方法已废弃,请使用开放函数代替 https://doc.mini.talelin.com/start/open-function.html'); + this.linHide(); }; }, @@ -118,6 +101,41 @@ Component({ } eventUtil.emit(this, 'lintap'); + }, + + // ================= 开放函数 ======================== + /** + * 显示 Popup + */ + linShow(options) { + const { + zIndex = 99, + animation = true, + contentAlign = 'center', + locked = false + } = {...options}; + this.setData({ + zIndex, + animation, + contentAlign, + locked, + show: true + }); + }, + + /** + * 隐藏 Popup + * 会忽略 locked 属性 + */ + linHide() { + this.setData({ + status: 'hide' + }); + setTimeout(() => { + this.setData({ + show: false + }); + }, 300); } } }); -- Gitee From 5658728bc7bbad2125e5902f63c5741bc38d6ae8 Mon Sep 17 00:00:00 2001 From: Juzi Date: Tue, 16 Feb 2021 21:02:06 +0800 Subject: [PATCH 08/15] build: Travis CI automatic compilation --- dist/popup/index.wxss | 2 +- examples/dist/popup/index.js | 1 - examples/dist/popup/index.wxss | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dist/popup/index.wxss b/dist/popup/index.wxss index f228b27..5849fbb 100644 --- a/dist/popup/index.wxss +++ b/dist/popup/index.wxss @@ -1 +1 @@ -.popup-fade-center-active-show{animation:popup-center-fadein .3s forwards}.popup-fade-center-active-hide{animation:popup-center-fadeout .3s forwards}.popup-fade-top-active-show{animation:popup-top-fadein .3s forwards}.popup-fade-top-active-hide{animation:popup-top-fadeout .3s forwards}.popup-fade-left-active-show{animation:popup-left-fadein .3s forwards}.popup-fade-left-active-hide{animation:popup-left-fadeout .3s forwards}.popup-fade-right-active-show{animation:popup-right-fadein .3s forwards}.popup-fade-right-active-hide{animation:popup-right-fadeout .3s forwards}.popup-fade-bottom-active-show{animation:popup-bottom-fadein .3s forwards}.popup-fade-bottom-active-hide{animation:popup-bottom-fadeout .3s forwards}@keyframes popup-top-fadein{0%{transform:translate3d(0,-100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-top-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,-100%,0);opacity:.1}}@keyframes popup-left-fadein{0%{transform:translate3d(-100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-left-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(-100%,0,0);opacity:.1}}@keyframes popup-right-fadein{0%{transform:translate3d(100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-right-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(100%,0,0);opacity:.1}}@keyframes popup-bottom-fadein{0%{transform:translate3d(0,100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-bottom-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,100%,0);opacity:.1}}@keyframes popup-center-fadein{0%{transform:scale(.8);opacity:0}50%{transform:scale(1.1)}100%{transform:scale(1);opacity:1}}@keyframes popup-center-fadeout{0%{transform:scale(1);opacity:1}50%{transform:scale(1.1)}100%{transform:scale(.8);opacity:0}}.container-popup{position:fixed;top:0;left:0;right:0;bottom:0}.container-bg-show{opacity:1}.container-bg-hide{opacity:0}.container-bg{display:block;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.4);transition:all .3s ease-in-out}.popup-content{position:absolute;z-index:100;width:100%;max-width:100%;height:100%}.center{display:flex;height:100%;width:100%;flex-direction:row;align-items:center;justify-content:center}.left{display:flex;flex-direction:row;height:100%}.right{display:flex;flex-direction:row;justify-content:flex-end;height:100%}.bottom{display:flex;flex-direction:column-reverse;width:100%} \ No newline at end of file +.popup-fade-center-active-show{animation:popup-center-fadein .3s forwards}.popup-fade-center-active-hide{animation:popup-center-fadeout .3s forwards}.popup-fade-top-active-show{animation:popup-top-fadein .3s forwards}.popup-fade-top-active-hide{animation:popup-top-fadeout .3s forwards}.popup-fade-left-active-show{animation:popup-left-fadein .3s forwards}.popup-fade-left-active-hide{animation:popup-left-fadeout .3s forwards}.popup-fade-right-active-show{animation:popup-right-fadein .3s forwards}.popup-fade-right-active-hide{animation:popup-right-fadeout .3s forwards}.popup-fade-bottom-active-show{animation:popup-bottom-fadein .3s forwards}.popup-fade-bottom-active-hide{animation:popup-bottom-fadeout .3s forwards}@keyframes popup-top-fadein{0%{transform:translate3d(0,-100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-top-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,-100%,0);opacity:.1}}@keyframes popup-left-fadein{0%{transform:translate3d(-100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-left-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(-100%,0,0);opacity:.1}}@keyframes popup-right-fadein{0%{transform:translate3d(100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-right-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(100%,0,0);opacity:.1}}@keyframes popup-bottom-fadein{0%{transform:translate3d(0,100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-bottom-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,100%,0);opacity:.1}}@keyframes popup-center-fadein{0%{transform:scale(.8);opacity:0}50%{transform:scale(1.1)}100%{transform:scale(1);opacity:1}}@keyframes popup-center-fadeout{0%{transform:scale(1);opacity:1}50%{transform:scale(1.1)}100%{transform:scale(.8);opacity:0}}@keyframes bg-fadein{0%{opacity:0}100%{opacity:1}}@keyframes bg-fadeout{0%{opacity:1}100%{opacity:0}}.container-popup{position:fixed;top:0;left:0;right:0;bottom:0}.container-bg-show{animation:bg-fadein .3s forwards}.container-bg-hide{animation:bg-fadeout .3s forwards}.container-bg{display:block;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.4)}.popup-content{position:absolute;z-index:100;width:100%;max-width:100%;height:100%}.center{display:flex;height:100%;width:100%;flex-direction:row;align-items:center;justify-content:center}.left{display:flex;flex-direction:row;height:100%}.right{display:flex;flex-direction:row;justify-content:flex-end;height:100%}.bottom{display:flex;flex-direction:column-reverse;width:100%} \ No newline at end of file diff --git a/examples/dist/popup/index.js b/examples/dist/popup/index.js index d22d990..b6ca901 100644 --- a/examples/dist/popup/index.js +++ b/examples/dist/popup/index.js @@ -67,7 +67,6 @@ Component({ status: 'show' }); } - } }, diff --git a/examples/dist/popup/index.wxss b/examples/dist/popup/index.wxss index f228b27..5849fbb 100644 --- a/examples/dist/popup/index.wxss +++ b/examples/dist/popup/index.wxss @@ -1 +1 @@ -.popup-fade-center-active-show{animation:popup-center-fadein .3s forwards}.popup-fade-center-active-hide{animation:popup-center-fadeout .3s forwards}.popup-fade-top-active-show{animation:popup-top-fadein .3s forwards}.popup-fade-top-active-hide{animation:popup-top-fadeout .3s forwards}.popup-fade-left-active-show{animation:popup-left-fadein .3s forwards}.popup-fade-left-active-hide{animation:popup-left-fadeout .3s forwards}.popup-fade-right-active-show{animation:popup-right-fadein .3s forwards}.popup-fade-right-active-hide{animation:popup-right-fadeout .3s forwards}.popup-fade-bottom-active-show{animation:popup-bottom-fadein .3s forwards}.popup-fade-bottom-active-hide{animation:popup-bottom-fadeout .3s forwards}@keyframes popup-top-fadein{0%{transform:translate3d(0,-100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-top-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,-100%,0);opacity:.1}}@keyframes popup-left-fadein{0%{transform:translate3d(-100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-left-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(-100%,0,0);opacity:.1}}@keyframes popup-right-fadein{0%{transform:translate3d(100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-right-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(100%,0,0);opacity:.1}}@keyframes popup-bottom-fadein{0%{transform:translate3d(0,100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-bottom-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,100%,0);opacity:.1}}@keyframes popup-center-fadein{0%{transform:scale(.8);opacity:0}50%{transform:scale(1.1)}100%{transform:scale(1);opacity:1}}@keyframes popup-center-fadeout{0%{transform:scale(1);opacity:1}50%{transform:scale(1.1)}100%{transform:scale(.8);opacity:0}}.container-popup{position:fixed;top:0;left:0;right:0;bottom:0}.container-bg-show{opacity:1}.container-bg-hide{opacity:0}.container-bg{display:block;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.4);transition:all .3s ease-in-out}.popup-content{position:absolute;z-index:100;width:100%;max-width:100%;height:100%}.center{display:flex;height:100%;width:100%;flex-direction:row;align-items:center;justify-content:center}.left{display:flex;flex-direction:row;height:100%}.right{display:flex;flex-direction:row;justify-content:flex-end;height:100%}.bottom{display:flex;flex-direction:column-reverse;width:100%} \ No newline at end of file +.popup-fade-center-active-show{animation:popup-center-fadein .3s forwards}.popup-fade-center-active-hide{animation:popup-center-fadeout .3s forwards}.popup-fade-top-active-show{animation:popup-top-fadein .3s forwards}.popup-fade-top-active-hide{animation:popup-top-fadeout .3s forwards}.popup-fade-left-active-show{animation:popup-left-fadein .3s forwards}.popup-fade-left-active-hide{animation:popup-left-fadeout .3s forwards}.popup-fade-right-active-show{animation:popup-right-fadein .3s forwards}.popup-fade-right-active-hide{animation:popup-right-fadeout .3s forwards}.popup-fade-bottom-active-show{animation:popup-bottom-fadein .3s forwards}.popup-fade-bottom-active-hide{animation:popup-bottom-fadeout .3s forwards}@keyframes popup-top-fadein{0%{transform:translate3d(0,-100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-top-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,-100%,0);opacity:.1}}@keyframes popup-left-fadein{0%{transform:translate3d(-100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-left-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(-100%,0,0);opacity:.1}}@keyframes popup-right-fadein{0%{transform:translate3d(100%,0,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-right-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(100%,0,0);opacity:.1}}@keyframes popup-bottom-fadein{0%{transform:translate3d(0,100%,0);opacity:0}100%{transform:translate3d(0,0,0);opacity:1}}@keyframes popup-bottom-fadeout{0%{transform:translate3d(0,0,0);opacity:1}100%{transform:translate3d(0,100%,0);opacity:.1}}@keyframes popup-center-fadein{0%{transform:scale(.8);opacity:0}50%{transform:scale(1.1)}100%{transform:scale(1);opacity:1}}@keyframes popup-center-fadeout{0%{transform:scale(1);opacity:1}50%{transform:scale(1.1)}100%{transform:scale(.8);opacity:0}}@keyframes bg-fadein{0%{opacity:0}100%{opacity:1}}@keyframes bg-fadeout{0%{opacity:1}100%{opacity:0}}.container-popup{position:fixed;top:0;left:0;right:0;bottom:0}.container-bg-show{animation:bg-fadein .3s forwards}.container-bg-hide{animation:bg-fadeout .3s forwards}.container-bg{display:block;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.4)}.popup-content{position:absolute;z-index:100;width:100%;max-width:100%;height:100%}.center{display:flex;height:100%;width:100%;flex-direction:row;align-items:center;justify-content:center}.left{display:flex;flex-direction:row;height:100%}.right{display:flex;flex-direction:row;justify-content:flex-end;height:100%}.bottom{display:flex;flex-direction:column-reverse;width:100%} \ No newline at end of file -- Gitee From 8c2431f1bca958f0c38bb18e1161c445c42995ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=94=E5=AD=90?= Date: Tue, 16 Feb 2021 22:05:16 +0800 Subject: [PATCH 09/15] =?UTF-8?q?fix(Popup):=20=E4=BF=AE=E5=A4=8D=20animat?= =?UTF-8?q?ion=20=E4=B8=BA=20false=20=E6=97=B6=E6=9C=AA=E5=AE=8C=E5=85=A8?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=8A=A8=E7=94=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/view/pages/popup/pupop-nav.js | 14 +++++------ src/popup/index.js | 25 +++++++++++-------- src/popup/index.wxml | 2 +- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/examples/pages/components/view/pages/popup/pupop-nav.js b/examples/pages/components/view/pages/popup/pupop-nav.js index cffb4f8..11a0dab 100644 --- a/examples/pages/components/view/pages/popup/pupop-nav.js +++ b/examples/pages/components/view/pages/popup/pupop-nav.js @@ -3,7 +3,7 @@ const pupopNaviConfigs = [{ type: 0, config: { show: true, - animation: 'show', + animation: true, zIndex: 99, contentAlign: 'center', locked: false, @@ -14,7 +14,7 @@ const pupopNaviConfigs = [{ type: 1, config: { show: true, - animation: 'hide', + animation: false, zIndex: 99, contentAlign: 'center', locked: false, @@ -26,7 +26,7 @@ const pupopNaviConfigs = [{ type: 2, config: { show: true, - animation: 'show', + animation: true, zIndex: 99, contentAlign: 'top', locked: false, @@ -37,7 +37,7 @@ const pupopNaviConfigs = [{ type: 3, config: { show: true, - animation: 'show', + animation: true, zIndex: 99, contentAlign: 'right', locked: false, @@ -48,7 +48,7 @@ const pupopNaviConfigs = [{ type: 4, config: { show: true, - animation: 'show', + animation: true, zIndex: 99, contentAlign: 'bottom', locked: false, @@ -59,7 +59,7 @@ const pupopNaviConfigs = [{ type: 5, config: { show: true, - animation: 'show', + animation: true, zIndex: 99, contentAlign: 'left', locked: false, @@ -70,7 +70,7 @@ const pupopNaviConfigs = [{ type: 6, config: { show: true, - animation: 'show', + animation: true, zIndex: 99, contentAlign: 'bottom', locked: true, diff --git a/src/popup/index.js b/src/popup/index.js index b6ca901..d6235bb 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -89,17 +89,29 @@ Component({ // 点击事件 onPopupTap() { if (this.data.locked !== true) { + this._hidePopup(); + } + + eventUtil.emit(this, 'lintap'); + }, + + _hidePopup(){ + if(this.data.animation){ this.setData({ status: 'hide' }); + // 延迟 300ms 等动画结束再去掉节点 setTimeout(() => { this.setData({ show: false }); }, 300); + }else{ + this.setData({ + show: false, + status: 'hide' + }); } - - eventUtil.emit(this, 'lintap'); }, // ================= 开放函数 ======================== @@ -127,14 +139,7 @@ Component({ * 会忽略 locked 属性 */ linHide() { - this.setData({ - status: 'hide' - }); - setTimeout(() => { - this.setData({ - show: false - }); - }, 300); + this._hidePopup(); } } }); diff --git a/src/popup/index.wxml b/src/popup/index.wxml index b6f1e12..a28fa38 100644 --- a/src/popup/index.wxml +++ b/src/popup/index.wxml @@ -1,7 +1,7 @@ - + -- Gitee From 4869502e3dc29f180d2d8848add50792ff18d735 Mon Sep 17 00:00:00 2001 From: Juzi Date: Tue, 16 Feb 2021 22:20:40 +0800 Subject: [PATCH 10/15] build: Travis CI automatic compilation --- dist/popup/index.js | 2 +- dist/popup/index.wxml | 2 +- examples/dist/popup/index.js | 25 +++++++++++++++---------- examples/dist/popup/index.wxml | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/dist/popup/index.js b/dist/popup/index.js index 23cb64b..a006e69 100644 --- a/dist/popup/index.js +++ b/dist/popup/index.js @@ -1 +1 @@ -import zIndex from"../behaviors/zIndex";import validator from"../behaviors/validator";import eventUtil from"../core/utils/event-util";import doNothing from"../core/behaviors/doNothingBehavior";Component({behaviors:[zIndex,validator,doNothing],externalClasses:["l-bg-class","l-panel-class","l-class"],properties:{show:{type:Boolean,value:!1},animation:{type:Boolean,value:!0},transition:{type:Boolean,value:null},contentAlign:{type:String,value:"center",options:["top","right","left","bottom","center"]},direction:{type:String,value:null,options:["top","right","left","bottom","center"]},locked:{type:Boolean,value:!1}},attached(){this._init()},pageLifetimes:{show(){this._init()}},data:{status:"hide"},observers:{show(t){t&&this.setData({status:"show"})}},methods:{_init(){wx.lin=wx.lin||{},wx.lin.showPopup=t=>{console.warn("wx.lin 方法已废弃,请使用开放函数代替 https://doc.mini.talelin.com/start/open-function.html"),this.linShow(t)},wx.lin.hidePopup=()=>{console.warn("wx.lin 方法已废弃,请使用开放函数代替 https://doc.mini.talelin.com/start/open-function.html"),this.linHide()}},onPopupTap(){!0!==this.data.locked&&(this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)),eventUtil.emit(this,"lintap")},linShow(t){const{zIndex:e=99,animation:o=!0,contentAlign:i="center",locked:n=!1}={...t};this.setData({zIndex:e,animation:o,contentAlign:i,locked:n,show:!0})},linHide(){this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)}}}); \ No newline at end of file +import zIndex from"../behaviors/zIndex";import validator from"../behaviors/validator";import eventUtil from"../core/utils/event-util";import doNothing from"../core/behaviors/doNothingBehavior";Component({behaviors:[zIndex,validator,doNothing],externalClasses:["l-bg-class","l-panel-class","l-class"],properties:{show:{type:Boolean,value:!1},animation:{type:Boolean,value:!0},transition:{type:Boolean,value:null},contentAlign:{type:String,value:"center",options:["top","right","left","bottom","center"]},direction:{type:String,value:null,options:["top","right","left","bottom","center"]},locked:{type:Boolean,value:!1}},attached(){this._init()},pageLifetimes:{show(){this._init()}},data:{status:"hide"},observers:{show(t){t&&this.setData({status:"show"})}},methods:{_init(){wx.lin=wx.lin||{},wx.lin.showPopup=t=>{console.warn("wx.lin 方法已废弃,请使用开放函数代替 https://doc.mini.talelin.com/start/open-function.html"),this.linShow(t)},wx.lin.hidePopup=()=>{console.warn("wx.lin 方法已废弃,请使用开放函数代替 https://doc.mini.talelin.com/start/open-function.html"),this.linHide()}},onPopupTap(){!0!==this.data.locked&&this._hidePopup(),eventUtil.emit(this,"lintap")},_hidePopup(){this.data.animation?(this.setData({status:"hide"}),setTimeout(()=>{this.setData({show:!1})},300)):this.setData({show:!1,status:"hide"})},linShow(t){const{zIndex:i=99,animation:o=!0,contentAlign:e="center",locked:n=!1}={...t};this.setData({zIndex:i,animation:o,contentAlign:e,locked:n,show:!0})},linHide(){this._hidePopup()}}}); \ No newline at end of file diff --git a/dist/popup/index.wxml b/dist/popup/index.wxml index 152af98..55930c6 100644 --- a/dist/popup/index.wxml +++ b/dist/popup/index.wxml @@ -1,5 +1,5 @@ - + diff --git a/examples/dist/popup/index.js b/examples/dist/popup/index.js index b6ca901..d6235bb 100644 --- a/examples/dist/popup/index.js +++ b/examples/dist/popup/index.js @@ -89,17 +89,29 @@ Component({ // 点击事件 onPopupTap() { if (this.data.locked !== true) { + this._hidePopup(); + } + + eventUtil.emit(this, 'lintap'); + }, + + _hidePopup(){ + if(this.data.animation){ this.setData({ status: 'hide' }); + // 延迟 300ms 等动画结束再去掉节点 setTimeout(() => { this.setData({ show: false }); }, 300); + }else{ + this.setData({ + show: false, + status: 'hide' + }); } - - eventUtil.emit(this, 'lintap'); }, // ================= 开放函数 ======================== @@ -127,14 +139,7 @@ Component({ * 会忽略 locked 属性 */ linHide() { - this.setData({ - status: 'hide' - }); - setTimeout(() => { - this.setData({ - show: false - }); - }, 300); + this._hidePopup(); } } }); diff --git a/examples/dist/popup/index.wxml b/examples/dist/popup/index.wxml index b6f1e12..a28fa38 100644 --- a/examples/dist/popup/index.wxml +++ b/examples/dist/popup/index.wxml @@ -1,7 +1,7 @@ - + -- Gitee From fe0c512eb13b1656b329831217aa9b80af32a4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=94=E5=AD=90?= Date: Tue, 16 Feb 2021 22:32:58 +0800 Subject: [PATCH 11/15] =?UTF-8?q?chore(Github):=20=E6=9B=B4=E6=96=B0=20iss?= =?UTF-8?q?ue=20=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug-report.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index c710071..2879700 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -22,6 +22,9 @@ assignees: '' **微信小程序基础库版本:** + +**微信开发者工具版本:** + **问题描述及重现步骤:** **相关截图**: -- Gitee From b874df42aaed3647551afa7dcccb8682b6c375ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=94=E5=AD=90?= Date: Tue, 23 Feb 2021 23:16:41 +0800 Subject: [PATCH 12/15] =?UTF-8?q?feat(Input):=20=E6=96=B0=E5=A2=9E=20adjus?= =?UTF-8?q?t-position=20=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/input/index.js | 5 +++++ src/input/index.wxml | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/input/index.js b/src/input/index.js index b6a4685..378c9ec 100644 --- a/src/input/index.js +++ b/src/input/index.js @@ -71,6 +71,11 @@ Component({ showEye: { type: Boolean, value: false + }, + // 键盘弹起时,是否自动上推页面 + adjustPosition:{ + type: Boolean, + value: true } }, diff --git a/src/input/index.wxml b/src/input/index.wxml index 72703fb..30b7672 100644 --- a/src/input/index.wxml +++ b/src/input/index.wxml @@ -14,6 +14,7 @@ Date: Tue, 23 Feb 2021 23:20:42 +0800 Subject: [PATCH 13/15] build: Travis CI automatic compilation --- dist/input/index.js | 2 +- dist/input/index.wxml | 4 ++-- examples/dist/input/index.js | 5 +++++ examples/dist/input/index.wxml | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dist/input/index.js b/dist/input/index.js index e8c56c8..45f0c7b 100644 --- a/dist/input/index.js +++ b/dist/input/index.js @@ -1 +1 @@ -import eventBus from"../core/utils/event-bus.js";import validator from"../behaviors/validator";import rules from"../behaviors/rules";Component({options:{multipleSlots:!0},behaviors:["wx://form-field",validator,rules],externalClasses:["l-class","l-label-class","l-error-text","l-error-text-class","l-input-class","l-row-class"],properties:{label:String,hideLabel:Boolean,labelCustom:Boolean,showRow:{type:Boolean,value:!0},required:Boolean,placeholder:String,type:{type:String,value:"text",options:["text","idcard","digit","password","number"]},value:String,colon:Boolean,focus:Boolean,clear:Boolean,maxlength:{type:Number,value:140},width:{type:Number,value:null},labelWidth:{type:Number,value:200},labelLayout:{type:String,value:"left",options:["left","right"]},disabled:Boolean,placeholderStyle:String,showEye:{type:Boolean,value:!1}},data:{},attached(){},methods:{handleInputChange(e){const{detail:t={}}=e,{value:a=""}=t;this.setData({value:a}),eventBus.emit("lin-form-change-"+this.id,this.id),this.triggerEvent("lininput",e.detail)},handleInputFocus(e){this.triggerEvent("linfocus",e.detail)},handleInputBlur(e){this.validatorData({[this.data.name]:e.detail.value}),eventBus.emit("lin-form-blur-"+this.id,this.id),this.triggerEvent("linblur",e.detail)},handleInputConfirm(e){const{detail:t={}}=e,{value:a=""}=t;this.setData({value:a}),this.triggerEvent("linconfirm",e.detail)},onClearTap(e){this.setData({value:""}),this.triggerEvent("linclear",e.detail)},getValues(){return this.data.value},reset(){this.setData({value:""})},onTapEyeIcon(){const e=this.data.type;"text"===e?this.setData({type:"password"}):"password"===e&&this.setData({type:"text"})}}}); \ No newline at end of file +import eventBus from"../core/utils/event-bus.js";import validator from"../behaviors/validator";import rules from"../behaviors/rules";Component({options:{multipleSlots:!0},behaviors:["wx://form-field",validator,rules],externalClasses:["l-class","l-label-class","l-error-text","l-error-text-class","l-input-class","l-row-class"],properties:{label:String,hideLabel:Boolean,labelCustom:Boolean,showRow:{type:Boolean,value:!0},required:Boolean,placeholder:String,type:{type:String,value:"text",options:["text","idcard","digit","password","number"]},value:String,colon:Boolean,focus:Boolean,clear:Boolean,maxlength:{type:Number,value:140},width:{type:Number,value:null},labelWidth:{type:Number,value:200},labelLayout:{type:String,value:"left",options:["left","right"]},disabled:Boolean,placeholderStyle:String,showEye:{type:Boolean,value:!1},adjustPosition:{type:Boolean,value:!0}},data:{},attached(){},methods:{handleInputChange(e){const{detail:t={}}=e,{value:a=""}=t;this.setData({value:a}),eventBus.emit("lin-form-change-"+this.id,this.id),this.triggerEvent("lininput",e.detail)},handleInputFocus(e){this.triggerEvent("linfocus",e.detail)},handleInputBlur(e){this.validatorData({[this.data.name]:e.detail.value}),eventBus.emit("lin-form-blur-"+this.id,this.id),this.triggerEvent("linblur",e.detail)},handleInputConfirm(e){const{detail:t={}}=e,{value:a=""}=t;this.setData({value:a}),this.triggerEvent("linconfirm",e.detail)},onClearTap(e){this.setData({value:""}),this.triggerEvent("linclear",e.detail)},getValues(){return this.data.value},reset(){this.setData({value:""})},onTapEyeIcon(){const e=this.data.type;"text"===e?this.setData({type:"password"}):"password"===e&&this.setData({type:"text"})}}}); \ No newline at end of file diff --git a/dist/input/index.wxml b/dist/input/index.wxml index 08a37f7..3b34a82 100644 --- a/dist/input/index.wxml +++ b/dist/input/index.wxml @@ -10,8 +10,8 @@ - - + + diff --git a/examples/dist/input/index.js b/examples/dist/input/index.js index b6a4685..378c9ec 100644 --- a/examples/dist/input/index.js +++ b/examples/dist/input/index.js @@ -71,6 +71,11 @@ Component({ showEye: { type: Boolean, value: false + }, + // 键盘弹起时,是否自动上推页面 + adjustPosition:{ + type: Boolean, + value: true } }, diff --git a/examples/dist/input/index.wxml b/examples/dist/input/index.wxml index 72703fb..30b7672 100644 --- a/examples/dist/input/index.wxml +++ b/examples/dist/input/index.wxml @@ -14,6 +14,7 @@ Date: Thu, 1 Apr 2021 20:14:14 +0800 Subject: [PATCH 14/15] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4jd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/README.md b/README.md index 4ae3238..1ac7529 100644 --- a/README.md +++ b/README.md @@ -32,26 +32,6 @@ --- -:collision::collision::collision:**林间有风团队招人啦**:collision::collision::collision: - -林间有风是一个致力于让 Web 开发变得简单而优雅的开源团队。 -目前团队的两款产品 Lin CMS 和 Lin UI 在 Github Star 均为 2000+ - -我们希望你: -1. 真正热爱开源,热爱编程,对开源有自己的理解 -2. 熟悉微信小程序官网文档和开发规范 -3. 熟悉 JavaScript、ES6、Vue 等前端相关生态 -4. 如果上述技术栈和你不符,但你仍然很热爱开源的话,我们也欢迎你的加入 - -你将得到的: -1. 参与大型开源项目的开发,学习团队如何严格的遵循开发规范,并享受帮助其他开发者的乐趣。 -2. 从一名普通“码农”变成真正的开发者,从枯燥的业务开发中抽身,站在更底层的角度思考问题。 -3. 为你的简历增光添彩,一个优秀的开源项目能为你本身的能力背书,在求职时也是非常亮眼的一点 - -:mailbox:简历投递邮箱:juzi214032@qq.com,主题格式 林间有风+姓名+学生/在职 - ---- - ## 目录 - [目录](#目录) -- Gitee From c74d918d53467efd022042619c4d20b2617f5b16 Mon Sep 17 00:00:00 2001 From: apple Date: Sat, 13 Nov 2021 20:49:29 +0800 Subject: [PATCH 15/15] test1 --- src/button/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/button/index.js b/src/button/index.js index 8258369..a60faf5 100644 --- a/src/button/index.js +++ b/src/button/index.js @@ -10,7 +10,7 @@ Component({ ], behaviors: [validator], properties: { - // button组建标识 + // button组建标识1111111 name: { type: String, value: 'lin' -- Gitee