vant-weapp/dist/toast/index.js
2017-02-07 20:37:08 +08:00

33 lines
565 B
JavaScript

module.exports = {
showZanToast(title, timeout) {
var zanToast = this.data.zanToast || {};
clearTimeout(zanToast.timer);
// 弹层设置~
zanToast = {
show: true,
title
};
this.setData({
zanToast
});
var timer = setTimeout(() => {
this.clearZanToast();
}, timeout || 3000);
this.setData({
'zanToast.timer': timer
});
},
clearZanToast() {
var zanToast = this.data.zanToast || {};
clearTimeout(zanToast.timer);
this.setData({
'zanToast.show': false
});
}
};