体质测试
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

39 lines
841 B

module.exports = {
showZanTopTips(content = '', options = {}) {
let zanTopTips = this.data.zanTopTips || {};
// 如果已经有一个计时器在了,就清理掉先
if (zanTopTips.timer) {
clearTimeout(zanTopTips.timer);
zanTopTips.timer = 0;
}
if (typeof options === 'number') {
options = {
duration: options
};
}
// options参数默认参数扩展
options = Object.assign({
duration: 3000
}, options);
// 设置定时器,定时关闭topTips
let timer = setTimeout(() => {
this.setData({
'zanTopTips.show': false,
'zanTopTips.timer': 0
});
}, options.duration);
// 展示出topTips
this.setData({
zanTopTips: {
show: true,
content,
options,
timer
}
});
}
};