// 第一步:在utils/showMsg.js文件中封装uni.showToast
uni.$showMsg = function(title = '数据加载失败!', icon = 'none') {
uni.showToast({
title,
duration: 1500,
icon
})
}
// 第二步:在main.js文件中引入封装的showMsg
// 引入封装的showMsg文件
import '@/utils/showMsg.js'
// 第三步:在.vue文件中直接通过uni.$showMsg()引用
// 例如:
uni.$showMsg('轮播图加载成功!', 'success');
02-08
1582

06-19
685

“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交