update(params).then(res => {
if (!res.error) {
this.idArray = [];
this.getTagNo(this.params.tagNumber);
let timeout = this.timeout;
if (timeout) {
clearTimeout(timeout);
timeout = null;
this.timeout = timeout;
}
this.timeout = setTimeout(() => {
uni.showToast({title:"修改成功",icon:"none"});
}, 1000);
}
});
用的vue,update外层还有个函数然后就是methods了,请问为什么这里setTimeout方法里必须是箭头函数showToast才能执行?
uni全局对象,不受this限制,类似原生的wx对象。
参考链接:
https://uniapp.dcloud.io/api/...