mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-23 06:59:15 +08:00
[build] 3.0.1
This commit is contained in:
parent
b42d1e8e8f
commit
f934380ce0
8
dist/btn-group/index.js
vendored
8
dist/btn-group/index.js
vendored
@ -2,7 +2,7 @@ Component({
|
|||||||
relations: {
|
relations: {
|
||||||
'../btn/index': {
|
'../btn/index': {
|
||||||
type: 'child',
|
type: 'child',
|
||||||
linked () {
|
linked() {
|
||||||
updateBtnChild.call(this);
|
updateBtnChild.call(this);
|
||||||
},
|
},
|
||||||
linkChange() {
|
linkChange() {
|
||||||
@ -16,10 +16,10 @@ Component({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function updateBtnChild() {
|
function updateBtnChild() {
|
||||||
let btns = this.getRelationNodes('../btn/index')
|
let btns = this.getRelationNodes('../btn/index');
|
||||||
|
|
||||||
if (btns.length > 0) {
|
if (btns.length > 0) {
|
||||||
let lastIndex = btns.length - 1
|
let lastIndex = btns.length - 1;
|
||||||
|
|
||||||
btns.forEach((btn, index) => {
|
btns.forEach((btn, index) => {
|
||||||
btn.switchLastButtonStatus(index === lastIndex);
|
btn.switchLastButtonStatus(index === lastIndex);
|
||||||
|
3
dist/btn/index.js
vendored
3
dist/btn/index.js
vendored
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
Component({
|
Component({
|
||||||
externalClasses: ['custom-class'],
|
externalClasses: ['custom-class'],
|
||||||
relations: {
|
relations: {
|
||||||
@ -53,4 +52,4 @@ Component({
|
|||||||
this.setData({ isLast });
|
this.setData({ isLast });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
20
dist/capsule/index.js
vendored
20
dist/capsule/index.js
vendored
@ -10,19 +10,19 @@ Component({
|
|||||||
value: ''
|
value: ''
|
||||||
},
|
},
|
||||||
// 自定义颜色
|
// 自定义颜色
|
||||||
color :{
|
color: {
|
||||||
type : String,
|
type: String,
|
||||||
value : ''
|
value: ''
|
||||||
},
|
},
|
||||||
// 左侧内容
|
// 左侧内容
|
||||||
leftText :{
|
leftText: {
|
||||||
type : String ,
|
type: String,
|
||||||
value : ''
|
value: ''
|
||||||
},
|
},
|
||||||
// 右侧内容
|
// 右侧内容
|
||||||
rightText :{
|
rightText: {
|
||||||
type : String ,
|
type: String,
|
||||||
value : ''
|
value: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
16
dist/cell-group/index.js
vendored
16
dist/cell-group/index.js
vendored
@ -2,18 +2,18 @@ Component({
|
|||||||
relations: {
|
relations: {
|
||||||
'../cell/index': {
|
'../cell/index': {
|
||||||
type: 'child',
|
type: 'child',
|
||||||
linked (target) {}
|
linked() {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ready () {
|
ready() {
|
||||||
let cells = this.getRelationNodes('../cell/index')
|
let cells = this.getRelationNodes('../cell/index');
|
||||||
|
|
||||||
if (cells.length > 0) {
|
if (cells.length > 0) {
|
||||||
let lastIndex = cells.length - 1
|
let lastIndex = cells.length - 1;
|
||||||
|
|
||||||
cells.forEach((cell, index) => {
|
cells.forEach((cell, index) => {
|
||||||
if (index < lastIndex) cell.notLastCell()
|
if (index < lastIndex) cell.notLastCell();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
33
dist/cell/index.js
vendored
33
dist/cell/index.js
vendored
@ -1,6 +1,7 @@
|
|||||||
const warn = (msg, getValue) => {
|
const warn = (msg, getValue) => {
|
||||||
console.warn(msg)
|
console.warn(msg);
|
||||||
};
|
|
||||||
|
};
|
||||||
|
|
||||||
Component({
|
Component({
|
||||||
options: {
|
options: {
|
||||||
@ -47,32 +48,32 @@ Component({
|
|||||||
isLastCell: true
|
isLastCell: true
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
navigateTo () {
|
navigateTo() {
|
||||||
const url = this.data.url
|
const { url = '' } = this.data;
|
||||||
const type = typeof this.data.isLink
|
const type = typeof this.data.isLink;
|
||||||
|
|
||||||
this.triggerEvent('tap', {})
|
this.triggerEvent('tap', {});
|
||||||
|
|
||||||
if (!this.data.isLink || !url || url === 'true' || url === 'false') return;
|
if (!this.data.isLink || !url || url === 'true' || url === 'false') return;
|
||||||
|
|
||||||
if (type !== 'boolean' && type !== 'string') {
|
if (type !== 'boolean' && type !== 'string') {
|
||||||
warn('isLink 属性值必须是一个字符串或布尔值', this.data.isLink)
|
warn('isLink 属性值必须是一个字符串或布尔值', this.data.isLink);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (['navigateTo', 'redirectTo', 'switchTab', 'reLaunch'].indexOf(this.data.linkType) === -1) {
|
if (['navigateTo', 'redirectTo', 'switchTab', 'reLaunch'].indexOf(this.data.linkType) === -1) {
|
||||||
warn('linkType 属性可选值为 navigateTo,redirectTo,switchTab,reLaunch', this.data.linkType)
|
warn('linkType 属性可选值为 navigateTo,redirectTo,switchTab,reLaunch', this.data.linkType);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
wx[this.data.linkType].call(wx, { url })
|
wx[this.data.linkType].call(wx, { url });
|
||||||
},
|
},
|
||||||
cellTap () {
|
cellTap() {
|
||||||
if (!this.data.onlyTapFooter) {
|
if (!this.data.onlyTapFooter) {
|
||||||
this.navigateTo()
|
this.navigateTo();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
notLastCell () {
|
notLastCell() {
|
||||||
this.setData({ isLastCell: false })
|
this.setData({ isLastCell: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
6
dist/dialog/dialog.js
vendored
6
dist/dialog/dialog.js
vendored
@ -22,7 +22,7 @@ function Dialog(options, pageCtx) {
|
|||||||
|
|
||||||
// 处理默认按钮的展示
|
// 处理默认按钮的展示
|
||||||
// 纵向排布确认按钮在上方
|
// 纵向排布确认按钮在上方
|
||||||
const buttons = parsedOptions.buttons;
|
const { buttons = [] } = parsedOptions;
|
||||||
let showCustomBtns = false;
|
let showCustomBtns = false;
|
||||||
if (buttons.length === 0) {
|
if (buttons.length === 0) {
|
||||||
if (parsedOptions.showConfirmButton) {
|
if (parsedOptions.showConfirmButton) {
|
||||||
@ -59,6 +59,6 @@ function Dialog(options, pageCtx) {
|
|||||||
promiseFunc: { resolve, reject }
|
promiseFunc: { resolve, reject }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
module.exports = Dialog;
|
module.exports = Dialog;
|
||||||
|
2
dist/dialog/index.js
vendored
2
dist/dialog/index.js
vendored
@ -1,6 +1,6 @@
|
|||||||
const defaultData = require('./data');
|
const defaultData = require('./data');
|
||||||
|
|
||||||
const _f = function() {};
|
const _f = function () {};
|
||||||
|
|
||||||
Component({
|
Component({
|
||||||
properties: {},
|
properties: {},
|
||||||
|
10
dist/field/index.js
vendored
10
dist/field/index.js
vendored
@ -32,17 +32,17 @@ Component({
|
|||||||
|
|
||||||
this.triggerEvent('change', event);
|
this.triggerEvent('change', event);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleZanFieldFocus(event) {
|
handleZanFieldFocus(event) {
|
||||||
|
|
||||||
|
|
||||||
this.triggerEvent('focus', event);
|
this.triggerEvent('focus', event);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleZanFieldBlur(event) {
|
handleZanFieldBlur(event) {
|
||||||
|
|
||||||
|
|
||||||
this.triggerEvent('blur', event);
|
this.triggerEvent('blur', event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
2
dist/loading/index.js
vendored
2
dist/loading/index.js
vendored
@ -8,4 +8,4 @@ Component({
|
|||||||
type: String
|
type: String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
99
dist/noticebar/index.js
vendored
99
dist/noticebar/index.js
vendored
@ -86,66 +86,69 @@ Component({
|
|||||||
|
|
||||||
_init() {
|
_init() {
|
||||||
wx.createSelectorQuery()
|
wx.createSelectorQuery()
|
||||||
.in(this)
|
.in(this)
|
||||||
.select('.zan-noticebar__content')
|
.select('.zan-noticebar__content')
|
||||||
.boundingClientRect(rect => {
|
.boundingClientRect((rect) => {
|
||||||
if (!rect || !rect.width) {
|
if (!rect || !rect.width) {
|
||||||
throw new Error('页面缺少 noticebar 元素');
|
throw new Error('页面缺少 noticebar 元素');
|
||||||
return;
|
}
|
||||||
}
|
this.setData({
|
||||||
this.setData({
|
width: rect.width
|
||||||
width: rect.width
|
});
|
||||||
});
|
|
||||||
|
|
||||||
wx.createSelectorQuery()
|
wx.createSelectorQuery()
|
||||||
.in(this)
|
.in(this)
|
||||||
.select('.zan-noticebar__content-wrap')
|
.select('.zan-noticebar__content-wrap')
|
||||||
.boundingClientRect((rect) => {
|
.boundingClientRect((rect) => {
|
||||||
if (!rect || !rect.width) {
|
if (!rect || !rect.width) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wrapWidth = rect.width;
|
const wrapWidth = rect.width;
|
||||||
const { width, speed, scrollable, delay } = this.data;
|
const {
|
||||||
|
width, speed, scrollable, delay
|
||||||
|
} = this.data;
|
||||||
|
|
||||||
if (scrollable && wrapWidth < width) {
|
if (scrollable && wrapWidth < width) {
|
||||||
const elapse = width / speed * 1000;
|
const elapse = width / speed * 1000;
|
||||||
const animation = wx.createAnimation({
|
const animation = wx.createAnimation({
|
||||||
duration: elapse,
|
duration: elapse,
|
||||||
timeingFunction: 'linear',
|
timeingFunction: 'linear',
|
||||||
delay
|
delay
|
||||||
});
|
});
|
||||||
const resetAnimation = wx.createAnimation({
|
const resetAnimation = wx.createAnimation({
|
||||||
duration: 0,
|
duration: 0,
|
||||||
timeingFunction: 'linear'
|
timeingFunction: 'linear'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setData({
|
this.setData({
|
||||||
elapse,
|
elapse,
|
||||||
wrapWidth,
|
wrapWidth,
|
||||||
animation,
|
animation,
|
||||||
resetAnimation
|
resetAnimation
|
||||||
}, () => {
|
}, () => {
|
||||||
this._scroll();
|
this._scroll();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.exec();
|
.exec();
|
||||||
})
|
})
|
||||||
.exec();
|
.exec();
|
||||||
},
|
},
|
||||||
|
|
||||||
_scroll() {
|
_scroll() {
|
||||||
const { animation, resetAnimation, wrapWidth, elapse, speed } = this.data;
|
const {
|
||||||
const resetAnimationData = resetAnimation.translateX(wrapWidth).step();
|
animation, resetAnimation, wrapWidth, elapse, speed
|
||||||
const animationData = animation.translateX(-elapse * speed / 1000).step();
|
} = this.data;
|
||||||
|
resetAnimation.translateX(wrapWidth).step();
|
||||||
|
const animationData = animation.translateX(-(elapse * speed) / 1000).step();
|
||||||
this.setData({
|
this.setData({
|
||||||
animationData: resetAnimation.export()
|
animationData: resetAnimation.export()
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setData({
|
this.setData({
|
||||||
animationData: animationData.export()
|
animationData: animationData.export()
|
||||||
})
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
@ -166,4 +169,4 @@ Component({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
14
dist/panel/index.js
vendored
14
dist/panel/index.js
vendored
@ -10,14 +10,14 @@ Component({
|
|||||||
value: ''
|
value: ''
|
||||||
},
|
},
|
||||||
// 内容区顶部是否取消10像素的间距
|
// 内容区顶部是否取消10像素的间距
|
||||||
hideTop :{
|
hideTop: {
|
||||||
type : Boolean ,
|
type: Boolean,
|
||||||
value : false
|
value: false
|
||||||
},
|
},
|
||||||
// 内容区顶部是否取消边框
|
// 内容区顶部是否取消边框
|
||||||
hideBorder :{
|
hideBorder: {
|
||||||
type : Boolean ,
|
type: Boolean,
|
||||||
value : false
|
value: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
21
dist/stepper/index.js
vendored
21
dist/stepper/index.js
vendored
@ -21,10 +21,10 @@ Component({
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
handleZanStepperChange(e, type) {
|
handleZanStepperChange(e, type) {
|
||||||
const dataset = e.currentTarget.dataset;
|
const { dataset = {} } = e.currentTarget;
|
||||||
const disabled = dataset.disabled;
|
const { disabled } = dataset;
|
||||||
const { step } = this.data;
|
const { step } = this.data;
|
||||||
let stepper = this.data.stepper;
|
let { stepper } = this.data;
|
||||||
|
|
||||||
if (disabled) return null;
|
if (disabled) return null;
|
||||||
|
|
||||||
@ -41,30 +41,29 @@ Component({
|
|||||||
handleZanStepperMinus(e) {
|
handleZanStepperMinus(e) {
|
||||||
this.handleZanStepperChange(e, 'minus');
|
this.handleZanStepperChange(e, 'minus');
|
||||||
},
|
},
|
||||||
|
|
||||||
handleZanStepperPlus(e) {
|
handleZanStepperPlus(e) {
|
||||||
this.handleZanStepperChange( e, 'plus');
|
this.handleZanStepperChange(e, 'plus');
|
||||||
},
|
},
|
||||||
|
|
||||||
handleZanStepperBlur(e) {
|
handleZanStepperBlur(e) {
|
||||||
const dataset = e.currentTarget.dataset;
|
let { value } = e.detail;
|
||||||
let value = e.detail.value;
|
|
||||||
const { min, max } = this.data;
|
const { min, max } = this.data;
|
||||||
|
|
||||||
if (!value) {
|
if (!value) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.triggerEvent('change', min);
|
this.triggerEvent('change', min);
|
||||||
}, 16);
|
}, 16);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = +value;
|
value = +value;
|
||||||
if (value > max) {
|
if (value > max) {
|
||||||
value = max;
|
value = max;
|
||||||
} else if (value < min) {
|
} else if (value < min) {
|
||||||
value = min;
|
value = min;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.triggerEvent('change', value);
|
this.triggerEvent('change', value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
dist/steps/index.js
vendored
2
dist/steps/index.js
vendored
@ -17,4 +17,4 @@ Component({
|
|||||||
|
|
||||||
className: String
|
className: String
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
2
dist/switch/index.js
vendored
2
dist/switch/index.js
vendored
@ -17,7 +17,7 @@ Component({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
handleZanSwitchChange(event) {
|
handleZanSwitchChange() {
|
||||||
if (this.data.loading || this.data.disabled) {
|
if (this.data.loading || this.data.disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
2
dist/tab/index.js
vendored
2
dist/tab/index.js
vendored
@ -36,4 +36,4 @@ Component({
|
|||||||
this.triggerEvent('tabchange', selectedId);
|
this.triggerEvent('tabchange', selectedId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
2
dist/tag/index.js
vendored
2
dist/tag/index.js
vendored
@ -12,4 +12,4 @@ Component({
|
|||||||
value: false,
|
value: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
20
dist/toast/toast.js
vendored
20
dist/toast/toast.js
vendored
@ -1,7 +1,7 @@
|
|||||||
let timeoutData = {
|
let timeoutData = {
|
||||||
timeoutId: 0,
|
timeoutId: 0,
|
||||||
toastCtx: null
|
toastCtx: null
|
||||||
}
|
};
|
||||||
|
|
||||||
function Toast(options = {}, pageCtx) {
|
function Toast(options = {}, pageCtx) {
|
||||||
let ctx = pageCtx;
|
let ctx = pageCtx;
|
||||||
@ -32,29 +32,31 @@ function Toast(options = {}, pageCtx) {
|
|||||||
timeoutData = {
|
timeoutData = {
|
||||||
timeoutId,
|
timeoutId,
|
||||||
toastCtx
|
toastCtx
|
||||||
}
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
// 清理所有 toast
|
// 清理所有 toast
|
||||||
Toast.clear = function() {
|
Toast.clear = function () {
|
||||||
clearTimeout(timeoutData.timeoutId);
|
clearTimeout(timeoutData.timeoutId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
timeoutData.toastCtx && timeoutData.toastCtx.clear();
|
timeoutData.toastCtx && timeoutData.toastCtx.clear();
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
timeoutData = {
|
timeoutData = {
|
||||||
timeoutId: 0,
|
timeoutId: 0,
|
||||||
toastCtx: null
|
toastCtx: null
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
// 显示 loading
|
// 显示 loading
|
||||||
Toast.loading = function(options = {}) {
|
Toast.loading = function (options = {}) {
|
||||||
Toast({
|
Toast({
|
||||||
...options,
|
...options,
|
||||||
type: 'loading'
|
type: 'loading'
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
module.exports = Toast;
|
module.exports = Toast;
|
||||||
|
6
dist/toptips/index.js
vendored
6
dist/toptips/index.js
vendored
@ -24,7 +24,7 @@ Component({
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
show() {
|
show() {
|
||||||
const duration = this.data.duration;
|
const { duration } = this.data;
|
||||||
|
|
||||||
this._timer && clearTimeout(this._timer);
|
this._timer && clearTimeout(this._timer);
|
||||||
this.setData({
|
this.setData({
|
||||||
@ -56,7 +56,7 @@ function Toptips(options = {}) {
|
|||||||
duration: 3000
|
duration: 3000
|
||||||
};
|
};
|
||||||
|
|
||||||
options = Object.assign(defaultOptions,parseParam(options));
|
options = Object.assign(defaultOptions, parseParam(options));
|
||||||
|
|
||||||
const $toptips = ctx.selectComponent(options.selector);
|
const $toptips = ctx.selectComponent(options.selector);
|
||||||
delete options.selector;
|
delete options.selector;
|
||||||
@ -71,4 +71,4 @@ function parseParam(params) {
|
|||||||
return typeof params === 'object' ? params : { content: params };
|
return typeof params === 'object' ? params : { content: params };
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Toptips;
|
module.exports = Toptips;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user