mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +08:00
[breaking change] use es module (#499)
This commit is contained in:
parent
57f8e54b19
commit
63bddbddfb
2
dist/behaviors/button.js
vendored
2
dist/behaviors/button.js
vendored
@ -1,4 +1,4 @@
|
||||
module.exports = Behavior({
|
||||
export default Behavior({
|
||||
properties: {
|
||||
loading: Boolean,
|
||||
// 在自定义组件中,无法与外界的 form 组件联动,暂时不开放
|
||||
|
2
dist/behaviors/touch.js
vendored
2
dist/behaviors/touch.js
vendored
@ -1,4 +1,4 @@
|
||||
module.exports = Behavior({
|
||||
export default Behavior({
|
||||
methods: {
|
||||
touchStart(event) {
|
||||
this.direction = '';
|
||||
|
52
dist/behaviors/transition.js
vendored
Normal file
52
dist/behaviors/transition.js
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
export default Behavior({
|
||||
properties: {
|
||||
customStyle: String,
|
||||
show: {
|
||||
value: true,
|
||||
type: Boolean,
|
||||
observer(value) {
|
||||
if (value) {
|
||||
this.show();
|
||||
} else {
|
||||
this.setData({
|
||||
type: 'leave'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
value: 300
|
||||
}
|
||||
},
|
||||
|
||||
data: {
|
||||
type: '',
|
||||
inited: false,
|
||||
display: false
|
||||
},
|
||||
|
||||
attached() {
|
||||
if (this.data.show) {
|
||||
this.show();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
show() {
|
||||
this.setData({
|
||||
inited: true,
|
||||
display: true,
|
||||
type: 'enter'
|
||||
});
|
||||
},
|
||||
|
||||
onAnimationEnd() {
|
||||
if (!this.data.show) {
|
||||
this.setData({
|
||||
display: false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
57
dist/button/behaviors.js
vendored
57
dist/button/behaviors.js
vendored
@ -1,57 +0,0 @@
|
||||
module.exports = Behavior({
|
||||
properties: {
|
||||
loading: Boolean,
|
||||
// 在自定义组件中,无法与外界的 form 组件联动,暂时不开放
|
||||
// formType: String,
|
||||
openType: String,
|
||||
appParameter: String,
|
||||
// 暂时不开放,直接传入无法设置样式
|
||||
// hoverClass: {
|
||||
// type: String,
|
||||
// value: 'button-hover'
|
||||
// },
|
||||
hoverStopPropagation: Boolean,
|
||||
hoverStartTime: {
|
||||
type: Number,
|
||||
value: 20
|
||||
},
|
||||
hoverStayTime: {
|
||||
type: Number,
|
||||
value: 70
|
||||
},
|
||||
lang: {
|
||||
type: String,
|
||||
value: 'en'
|
||||
},
|
||||
sessionFrom: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
sendMessageTitle: String,
|
||||
sendMessagePath: String,
|
||||
sendMessageImg: String,
|
||||
showMessageCard: String
|
||||
},
|
||||
|
||||
methods: {
|
||||
bindgetuserinfo(event = {}) {
|
||||
this.triggerEvent('getuserinfo', event.detail || {});
|
||||
},
|
||||
|
||||
bindcontact(event = {}) {
|
||||
this.triggerEvent('contact', event.detail || {});
|
||||
},
|
||||
|
||||
bindgetphonenumber(event = {}) {
|
||||
this.triggerEvent('getphonenumber', event.detail || {});
|
||||
},
|
||||
|
||||
bindopensetting(event = {}) {
|
||||
this.triggerEvent('opensetting', event.detail || {});
|
||||
},
|
||||
|
||||
binderror(event = {}) {
|
||||
this.triggerEvent('error', event.detail || {});
|
||||
}
|
||||
}
|
||||
});
|
22
dist/button/index.js
vendored
22
dist/button/index.js
vendored
@ -1,9 +1,5 @@
|
||||
const buttonBehaviors = require('../behaviors/button');
|
||||
const classnames = require('../common/classnames');
|
||||
|
||||
const observer = function() {
|
||||
this.setClasses();
|
||||
};
|
||||
import buttonBehaviors from '../behaviors/button';
|
||||
import classnames from '../common/classnames';
|
||||
|
||||
Component({
|
||||
options: {
|
||||
@ -18,32 +14,32 @@ Component({
|
||||
type: {
|
||||
type: String,
|
||||
value: 'default',
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
value: 'normal',
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
plain: {
|
||||
type: Boolean,
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
block: {
|
||||
type: Boolean,
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
square: {
|
||||
type: Boolean,
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
}
|
||||
},
|
||||
|
||||
|
2
dist/common/classnames.js
vendored
2
dist/common/classnames.js
vendored
@ -1,6 +1,6 @@
|
||||
const hasOwn = {}.hasOwnProperty;
|
||||
|
||||
module.exports = function classNames() {
|
||||
export default function classNames() {
|
||||
const classes = [];
|
||||
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
|
18
dist/popup/index.js
vendored
18
dist/popup/index.js
vendored
@ -1,3 +1,5 @@
|
||||
import transitionBehaviors from '../behaviors/transition';
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true
|
||||
@ -8,9 +10,23 @@ Component({
|
||||
'overlay-class'
|
||||
],
|
||||
|
||||
behaviors: [transitionBehaviors],
|
||||
|
||||
properties: {
|
||||
show: Boolean,
|
||||
overlayStyle: String,
|
||||
show: {
|
||||
value: false,
|
||||
type: Boolean,
|
||||
observer(value) {
|
||||
if (value) {
|
||||
this.show();
|
||||
} else {
|
||||
this.setData({
|
||||
type: 'leave'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
overlay: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
|
5
dist/popup/index.json
vendored
5
dist/popup/index.json
vendored
@ -1,3 +1,6 @@
|
||||
{
|
||||
"component": true
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-overlay": "../overlay/index"
|
||||
}
|
||||
}
|
||||
|
17
dist/popup/index.wxml
vendored
17
dist/popup/index.wxml
vendored
@ -1,9 +1,14 @@
|
||||
<view
|
||||
wx:if="{{ overlay }}"
|
||||
class="overlay-class van-popup__overlay {{ show ? 'van-popup--show' : '' }}"
|
||||
style="{{ overlayStyle }}"
|
||||
bind:tap="onClickOverlay"
|
||||
<van-overlay
|
||||
mask
|
||||
show="{{ overlay && show }}"
|
||||
custom-style="{{ overlayStyle }}"
|
||||
bind:click="onClickOverlay"
|
||||
/>
|
||||
<view class="custom-class van-popup {{ position ? 'van-popup--' + position : '' }} {{ show ? 'van-popup--show' : '' }}">
|
||||
<view
|
||||
wx:if="{{ inited }}"
|
||||
class="custom-class van-popup {{ position ? 'van-popup--' + position : '' }}"
|
||||
style="animation-name: van-{{ position }}-{{ type }}; animation-duration: {{ duration }}ms; {{ display ? '' : 'display: none;' }}"
|
||||
bind:animationend="onAnimationEnd"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
|
2
dist/popup/index.wxss
vendored
2
dist/popup/index.wxss
vendored
@ -1 +1 @@
|
||||
.van-popup{top:50%;left:50%;z-index:11;max-height:100%;overflow-y:auto;box-sizing:border-box;background-color:#fff;-webkit-overflow-scrolling:touch;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup,.van-popup__overlay{display:none;position:fixed;-webkit-animation:van-fade-in .3s ease;animation:van-fade-in .3s ease}.van-popup__overlay{width:100%;height:100%;top:0;left:0;z-index:10;background-color:rgba(0,0,0,.7)}.van-popup--top{width:100%;top:0;right:auto;bottom:auto;left:50%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0);-webkit-animation-name:van-popup-top;animation-name:van-popup-top}.van-popup--right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0);-webkit-animation-name:van-popup-right;animation-name:van-popup-right}.van-popup--bottom{width:100%;top:auto;bottom:0;right:auto;left:50%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0);-webkit-animation-name:van-popup-bottom;animation-name:van-popup-bottom}.van-popup--left{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0);-webkit-animation-name:van-popup-left;animation-name:van-popup-left}.van-popup--show{display:block}@-webkit-keyframes van-popup-top{from{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}}@keyframes van-popup-top{from{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}}@-webkit-keyframes van-popup-bottom{from{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}}@keyframes van-popup-bottom{from{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}}@-webkit-keyframes van-popup-left{from{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}}@keyframes van-popup-left{from{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}}@-webkit-keyframes van-popup-right{from{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}}@keyframes van-popup-right{from{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}}@-webkit-keyframes van-fade-in{from{opacity:0}to{opacity:1}}@keyframes van-fade-in{from{opacity:0}to{opacity:1}}
|
||||
.van-popup{top:50%;left:50%;z-index:11;position:fixed;max-height:100%;overflow-y:auto;box-sizing:border-box;background-color:#fff;-webkit-overflow-scrolling:touch;-webkit-animation:ease both;animation:ease both}.van-popup--center{-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup--top{width:100%;top:0;right:auto;bottom:auto;left:50%}.van-popup--right{top:50%;right:0;bottom:auto;left:auto}.van-popup--bottom{width:100%;top:auto;bottom:0;right:auto;left:50%}.van-popup--left{top:50%;right:auto;bottom:auto;left:0}@-webkit-keyframes van-center-enter{from{opacity:0}to{opacity:1}}@keyframes van-center-enter{from{opacity:0}to{opacity:1}}@-webkit-keyframes van-center-leave{from{opacity:1}to{opacity:0}}@keyframes van-center-leave{from{opacity:1}to{opacity:0}}@-webkit-keyframes van-bottom-enter{from{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}to{-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}}@keyframes van-bottom-enter{from{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}to{-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}}@-webkit-keyframes van-bottom-leave{from{-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}to{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}}@keyframes van-bottom-leave{from{-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}to{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}}@-webkit-keyframes van-top-enter{from{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}to{-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}}@keyframes van-top-enter{from{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}to{-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}}@-webkit-keyframes van-top-leave{from{-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}to{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}}@keyframes van-top-leave{from{-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}to{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}}@-webkit-keyframes van-left-enter{from{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}to{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}}@keyframes van-left-enter{from{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}to{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}}@-webkit-keyframes van-left-leave{from{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}to{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}}@keyframes van-left-leave{from{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}to{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}}@-webkit-keyframes van-right-enter{from{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}to{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}}@keyframes van-right-enter{from{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}to{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}}@-webkit-keyframes van-right-leave{from{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}to{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}}@keyframes van-right-leave{from{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}to{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}}
|
2
dist/slider/index.js
vendored
2
dist/slider/index.js
vendored
@ -1,4 +1,4 @@
|
||||
const touchBehaviors = require('../behaviors/touch');
|
||||
import touchBehaviors from '../behaviors/touch';
|
||||
|
||||
Component({
|
||||
options: {
|
||||
|
52
dist/transition/index.js
vendored
52
dist/transition/index.js
vendored
@ -1,3 +1,5 @@
|
||||
import transitionBehaviors from '../behaviors/transition';
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true
|
||||
@ -5,58 +7,12 @@ Component({
|
||||
|
||||
externalClasses: ['custom-class'],
|
||||
|
||||
behaviors: [transitionBehaviors],
|
||||
|
||||
properties: {
|
||||
customStyle: String,
|
||||
show: {
|
||||
value: true,
|
||||
type: Boolean,
|
||||
observer(value) {
|
||||
if (value) {
|
||||
this.show();
|
||||
} else {
|
||||
this.setData({
|
||||
type: 'leave'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
value: 'fade'
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
value: 300
|
||||
}
|
||||
},
|
||||
|
||||
data: {
|
||||
type: '',
|
||||
inited: false,
|
||||
display: false
|
||||
},
|
||||
|
||||
attached() {
|
||||
if (this.data.show) {
|
||||
this.show();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
show() {
|
||||
this.setData({
|
||||
inited: true,
|
||||
display: true,
|
||||
type: 'enter'
|
||||
});
|
||||
},
|
||||
|
||||
onAnimationEnd() {
|
||||
if (!this.data.show) {
|
||||
this.setData({
|
||||
display: false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
2
dist/utils/index.js
vendored
2
dist/utils/index.js
vendored
@ -7,7 +7,7 @@ function isObj(x) {
|
||||
return x !== null && (type === 'object' || type === 'function');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
isObj,
|
||||
isDef
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
module.exports = Behavior({
|
||||
export default Behavior({
|
||||
properties: {
|
||||
loading: Boolean,
|
||||
// 在自定义组件中,无法与外界的 form 组件联动,暂时不开放
|
||||
|
@ -1,4 +1,4 @@
|
||||
module.exports = Behavior({
|
||||
export default Behavior({
|
||||
methods: {
|
||||
touchStart(event) {
|
||||
this.direction = '';
|
||||
|
@ -1,4 +1,4 @@
|
||||
module.exports = Behavior({
|
||||
export default Behavior({
|
||||
properties: {
|
||||
customStyle: String,
|
||||
show: {
|
||||
|
@ -1,9 +1,5 @@
|
||||
const buttonBehaviors = require('../behaviors/button');
|
||||
const classnames = require('../common/classnames');
|
||||
|
||||
const observer = function() {
|
||||
this.setClasses();
|
||||
};
|
||||
import buttonBehaviors from '../behaviors/button';
|
||||
import classnames from '../common/classnames';
|
||||
|
||||
Component({
|
||||
options: {
|
||||
@ -18,32 +14,32 @@ Component({
|
||||
type: {
|
||||
type: String,
|
||||
value: 'default',
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
value: 'normal',
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
plain: {
|
||||
type: Boolean,
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
block: {
|
||||
type: Boolean,
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
},
|
||||
square: {
|
||||
type: Boolean,
|
||||
observer
|
||||
observer: 'setClasses'
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
const hasOwn = {}.hasOwnProperty;
|
||||
|
||||
module.exports = function classNames() {
|
||||
export default function classNames() {
|
||||
const classes = [];
|
||||
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const transitionBehaviors = require('../behaviors/transition');
|
||||
import transitionBehaviors from '../behaviors/transition';
|
||||
|
||||
Component({
|
||||
options: {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const touchBehaviors = require('../behaviors/touch');
|
||||
import touchBehaviors from '../behaviors/touch';
|
||||
|
||||
Component({
|
||||
options: {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const transitionBehaviors = require('../behaviors/transition');
|
||||
import transitionBehaviors from '../behaviors/transition';
|
||||
|
||||
Component({
|
||||
options: {
|
||||
|
@ -7,7 +7,7 @@ function isObj(x) {
|
||||
return x !== null && (type === 'object' || type === 'function');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
isObj,
|
||||
isDef
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user