| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import i18 from '@/utils/i18.js'
- export default {
- // 消息提示
- msg(content) {
- content = i18(content);
- uni.showToast({
- title: content,
- icon: 'none'
- })
- },
- // 错误消息
- msgError(content) {
- content = i18(content);
- uni.showToast({
- title: content,
- icon: 'error'
- })
- },
- // 成功消息
- msgSuccess(content) {
- content = i18(content);
- uni.showToast({
- title: content,
- icon: 'success'
- })
- },
- // 隐藏消息
- hideMsg(content) {
- uni.hideToast()
- },
- // 弹出提示
- alert(content) {
- content = i18(content);
- uni.showModal({
- title: i18('提示'),
- content: content,
- showCancel: false
- })
- },
- // 确认窗体
- confirm(content) {
- content = i18(content);
- return new Promise((resolve, reject) => {
- uni.showModal({
- title: i18('提示'),
- content: content,
- cancelText: i18('取消'),
- confirmText: i18('确认'),
- success: function(res) {
- if (res.confirm) {
- resolve(res.confirm)
- }
- }
- })
- })
- },
- // 提示信息
- showToast(option) {
- option = i18(option);
- if (typeof option === "object") {
- uni.showToast(option)
- } else {
- uni.showToast({
- title: option,
- icon: "none",
- duration: 2500
- })
- }
- },
- // 打开遮罩层
- loading(content,flag) {
- content = i18(content);
- if(flag){
- uni.showLoading({
- title: content,
- icon: 'none',
- mask:false
- })
- return;
- }
- uni.showLoading({
- title: content,
- icon: 'none',
- mask:true
- })
- },
- // 关闭遮罩层
- closeLoading() {
- uni.hideLoading()
- }
- }
|