让 showToast 可以回调 complete
This commit is contained in:
25
index.js
25
index.js
@@ -78,22 +78,21 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
showToast({type, icon, image, title, duration}){
|
||||
let pageNow = getCurrentPages().pop()
|
||||
if (pageNow.$refs && pageNow.$refs.toast) {
|
||||
pageNow.$refs.toast.open({type, content:title, duration})
|
||||
showToast({type, icon, image, title, duration, ...rest}){
|
||||
let pageNow = this.$store ? this : getCurrentPages().pop()
|
||||
if (pageNow.$refs && pageNow.$refs.toast) { // 在 ios app 里,虽然能获得 pageNow,但是不存在 pageNow.$refs,不知为何。android app 没有测试
|
||||
pageNow.$refs.toast.open({type, content:title, duration, ...rest})
|
||||
}else {
|
||||
// #ifndef APP-PLUS
|
||||
// #ifdef APP-PLUS
|
||||
if (uni.getSystemInfoSync().platform==='android') {
|
||||
uni.showToast({icon:'none', title, duration, ...rest})
|
||||
return
|
||||
}
|
||||
// #endif
|
||||
if (!image){
|
||||
image = `../static/Common.${type?type:'info'}.png`
|
||||
}
|
||||
uni.showToast({icon, image, title, duration})
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
if (uni.getSystemInfoSync().platform==='android') {
|
||||
uni.showToast({icon:'none', title, duration})
|
||||
}
|
||||
// #endif
|
||||
uni.showToast({icon, image, title, duration, ...rest})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -116,7 +115,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
formatPercent(value, decimal){
|
||||
return `${Number(value*100).toFixed(decimal||2)}%`
|
||||
return `${Number(value*100).toFixed(decimal||2)}`
|
||||
},
|
||||
|
||||
formatDate(date, format){
|
||||
|
||||
Reference in New Issue
Block a user