[build] 3.0.1

This commit is contained in:
pangxie1991 2018-04-30 23:50:08 +08:00
parent b42d1e8e8f
commit f934380ce0
18 changed files with 136 additions and 132 deletions

View File

@ -2,7 +2,7 @@ Component({
relations: {
'../btn/index': {
type: 'child',
linked () {
linked() {
updateBtnChild.call(this);
},
linkChange() {
@ -16,10 +16,10 @@ Component({
});
function updateBtnChild() {
let btns = this.getRelationNodes('../btn/index')
let btns = this.getRelationNodes('../btn/index');
if (btns.length > 0) {
let lastIndex = btns.length - 1
let lastIndex = btns.length - 1;
btns.forEach((btn, index) => {
btn.switchLastButtonStatus(index === lastIndex);

1
dist/btn/index.js vendored
View File

@ -1,4 +1,3 @@
Component({
externalClasses: ['custom-class'],
relations: {

20
dist/capsule/index.js vendored
View File

@ -10,19 +10,19 @@ Component({
value: ''
},
// 自定义颜色
color :{
type : String,
value : ''
color: {
type: String,
value: ''
},
// 左侧内容
leftText :{
type : String ,
value : ''
leftText: {
type: String,
value: ''
},
// 右侧内容
rightText :{
type : String ,
value : ''
rightText: {
type: String,
value: ''
}
}
})
});

View File

@ -2,18 +2,18 @@ Component({
relations: {
'../cell/index': {
type: 'child',
linked (target) {}
linked() {}
}
},
ready () {
let cells = this.getRelationNodes('../cell/index')
ready() {
let cells = this.getRelationNodes('../cell/index');
if (cells.length > 0) {
let lastIndex = cells.length - 1
let lastIndex = cells.length - 1;
cells.forEach((cell, index) => {
if (index < lastIndex) cell.notLastCell()
if (index < lastIndex) cell.notLastCell();
});
}
}
})
});

33
dist/cell/index.js vendored
View File

@ -1,6 +1,7 @@
const warn = (msg, getValue) => {
console.warn(msg)
};
console.warn(msg);
};
Component({
options: {
@ -47,32 +48,32 @@ Component({
isLastCell: true
},
methods: {
navigateTo () {
const url = this.data.url
const type = typeof this.data.isLink
navigateTo() {
const { url = '' } = this.data;
const type = typeof this.data.isLink;
this.triggerEvent('tap', {})
this.triggerEvent('tap', {});
if (!this.data.isLink || !url || url === 'true' || url === 'false') return;
if (type !== 'boolean' && type !== 'string') {
warn('isLink 属性值必须是一个字符串或布尔值', this.data.isLink)
return
warn('isLink 属性值必须是一个字符串或布尔值', this.data.isLink);
return;
}
if (['navigateTo', 'redirectTo', 'switchTab', 'reLaunch'].indexOf(this.data.linkType) === -1) {
warn('linkType 属性可选值为 navigateToredirectToswitchTabreLaunch', this.data.linkType)
return
warn('linkType 属性可选值为 navigateToredirectToswitchTabreLaunch', this.data.linkType);
return;
}
wx[this.data.linkType].call(wx, { url })
wx[this.data.linkType].call(wx, { url });
},
cellTap () {
cellTap() {
if (!this.data.onlyTapFooter) {
this.navigateTo()
this.navigateTo();
}
},
notLastCell () {
this.setData({ isLastCell: false })
notLastCell() {
this.setData({ isLastCell: false });
}
}
})
});

View File

@ -22,7 +22,7 @@ function Dialog(options, pageCtx) {
// 处理默认按钮的展示
// 纵向排布确认按钮在上方
const buttons = parsedOptions.buttons;
const { buttons = [] } = parsedOptions;
let showCustomBtns = false;
if (buttons.length === 0) {
if (parsedOptions.showConfirmButton) {
@ -59,6 +59,6 @@ function Dialog(options, pageCtx) {
promiseFunc: { resolve, reject }
});
});
};
}
module.exports = Dialog;

View File

@ -1,6 +1,6 @@
const defaultData = require('./data');
const _f = function() {};
const _f = function () {};
Component({
properties: {},

2
dist/field/index.js vendored
View File

@ -45,4 +45,4 @@ Component({
this.triggerEvent('blur', event);
}
}
})
});

View File

@ -8,4 +8,4 @@ Component({
type: String
}
}
})
});

View File

@ -88,10 +88,9 @@ Component({
wx.createSelectorQuery()
.in(this)
.select('.zan-noticebar__content')
.boundingClientRect(rect => {
.boundingClientRect((rect) => {
if (!rect || !rect.width) {
throw new Error('页面缺少 noticebar 元素');
return;
}
this.setData({
width: rect.width
@ -106,7 +105,9 @@ Component({
}
const wrapWidth = rect.width;
const { width, speed, scrollable, delay } = this.data;
const {
width, speed, scrollable, delay
} = this.data;
if (scrollable && wrapWidth < width) {
const elapse = width / speed * 1000;
@ -136,16 +137,18 @@ Component({
},
_scroll() {
const { animation, resetAnimation, wrapWidth, elapse, speed } = this.data;
const resetAnimationData = resetAnimation.translateX(wrapWidth).step();
const animationData = animation.translateX(-elapse * speed / 1000).step();
const {
animation, resetAnimation, wrapWidth, elapse, speed
} = this.data;
resetAnimation.translateX(wrapWidth).step();
const animationData = animation.translateX(-(elapse * speed) / 1000).step();
this.setData({
animationData: resetAnimation.export()
});
setTimeout(() => {
this.setData({
animationData: animationData.export()
})
});
}, 100);
const timer = setTimeout(() => {
@ -166,4 +169,4 @@ Component({
});
}
}
})
});

14
dist/panel/index.js vendored
View File

@ -10,14 +10,14 @@ Component({
value: ''
},
// 内容区顶部是否取消10像素的间距
hideTop :{
type : Boolean ,
value : false
hideTop: {
type: Boolean,
value: false
},
// 内容区顶部是否取消边框
hideBorder :{
type : Boolean ,
value : false
hideBorder: {
type: Boolean,
value: false
}
}
})
});

11
dist/stepper/index.js vendored
View File

@ -21,10 +21,10 @@ Component({
methods: {
handleZanStepperChange(e, type) {
const dataset = e.currentTarget.dataset;
const disabled = dataset.disabled;
const { dataset = {} } = e.currentTarget;
const { disabled } = dataset;
const { step } = this.data;
let stepper = this.data.stepper;
let { stepper } = this.data;
if (disabled) return null;
@ -43,12 +43,11 @@ Component({
},
handleZanStepperPlus(e) {
this.handleZanStepperChange( e, 'plus');
this.handleZanStepperChange(e, 'plus');
},
handleZanStepperBlur(e) {
const dataset = e.currentTarget.dataset;
let value = e.detail.value;
let { value } = e.detail;
const { min, max } = this.data;
if (!value) {

2
dist/steps/index.js vendored
View File

@ -17,4 +17,4 @@ Component({
className: String
}
})
});

View File

@ -17,7 +17,7 @@ Component({
},
methods: {
handleZanSwitchChange(event) {
handleZanSwitchChange() {
if (this.data.loading || this.data.disabled) {
return;
}

2
dist/tab/index.js vendored
View File

@ -36,4 +36,4 @@ Component({
this.triggerEvent('tabchange', selectedId);
}
}
})
});

20
dist/toast/toast.js vendored
View File

@ -1,7 +1,7 @@
let timeoutData = {
timeoutId: 0,
toastCtx: null
}
};
function Toast(options = {}, pageCtx) {
let ctx = pageCtx;
@ -32,29 +32,31 @@ function Toast(options = {}, pageCtx) {
timeoutData = {
timeoutId,
toastCtx
}
};
};
}
// 清理所有 toast
Toast.clear = function() {
Toast.clear = function () {
clearTimeout(timeoutData.timeoutId);
try {
timeoutData.toastCtx && timeoutData.toastCtx.clear();
} catch (e) {}
} catch (e) {
}
timeoutData = {
timeoutId: 0,
toastCtx: null
}
}
};
};
// 显示 loading
Toast.loading = function(options = {}) {
Toast.loading = function (options = {}) {
Toast({
...options,
type: 'loading'
});
}
};
module.exports = Toast;

View File

@ -24,7 +24,7 @@ Component({
methods: {
show() {
const duration = this.data.duration;
const { duration } = this.data;
this._timer && clearTimeout(this._timer);
this.setData({
@ -56,7 +56,7 @@ function Toptips(options = {}) {
duration: 3000
};
options = Object.assign(defaultOptions,parseParam(options));
options = Object.assign(defaultOptions, parseParam(options));
const $toptips = ctx.selectComponent(options.selector);
delete options.selector;