Browse Source

添加通用判断接口返回结果方法

xiaohaizhao 2 years ago
parent
commit
b45b752502
1 changed files with 11 additions and 0 deletions
  1. 11 0
      App.vue

+ 11 - 0
App.vue

@@ -2,6 +2,16 @@
 import Vue from 'vue'
 export default {
 	onLaunch: function () {
+		Vue.prototype.cutoff = (msg, title = "", mask = false, icon = 'none', duration = 2000,) => {
+			if (msg != '成功' || title) wx.showToast({
+				title: msg == '成功' ? title : msg,
+				duration,
+				icon,
+				mask,
+			})
+			return msg != '成功';
+		};
+
 		uni.getSystemInfo({
 			success: function (e) {
 				// #ifndef MP
@@ -38,4 +48,5 @@ export default {
 @import "colorui/icon.css";
 /* 你的项目css */
 @import "uni.scss";
+@import "static/iconfont/iconfont.css";
 </style>