让unisocket通用化;把showToast(...)集成在 cToast库里

This commit is contained in:
Luk Lu
2020-05-22 17:04:53 +08:00
parent 1ec8c2c600
commit 73bd6564c6
4 changed files with 43 additions and 25 deletions

17
cToast/cToast.js Normal file
View File

@@ -0,0 +1,17 @@
module.exports = function showToast({type, icon, image, title, duration}){
if (this.$refs && this.$refs.toast) {
this.$refs.toast.open({type, content:title, duration})
}else {
// #ifndef APP-PLUS
if (!image){
image = `../static/Common.${type}.png`
}
uni.showToast({icon, image, title, duration})
// #endif
// #ifdef APP-PLUS
if (uni.getSystemInfoSync().platform==='android') {
uni.showToast({icon:'none', title, duration})
}
// #endif
}
}