组件
export const showModal = (content, showCancel = false, title = "提示") => {
return new Promise((resolve, reject) => {
uni.showModal({
title: title,
content: content,
showCancel: showCancel,
success: (res) => {
resolve(res);
},
fail: (err) => {
reject(err);
},
});
});
};
export const showToast = (content, icon = "none") => {
return new Promise((resolve, reject) => {
uni.showToast({
title: content,
icon: icon,
success: (res) => {
resolve(res);
},
fail: (err) => {
reject(err);
},
});
});
};
export const showLoading = (content, mask = true) => {
return new Promise((resolve, reject) => {
uni.showLoading({
title: content,
mask: mask,
success: (res) => {
resolve(res);
},
fail: (err) => {
reject(err);
},
});
});
};
使用
import { showModal, showToast, showLoading } from "@/js/common.js";
showModal('1111');
showToast("保存成功");
showLoading("加载中");
感谢你的阅读,如对你有帮助请收藏+关注!
只分享干货实战和精品,从不啰嗦!!!
如某处不对请留言评论,欢迎指正~
博主可收徒、常玩QQ飞车,可一起来玩玩鸭~