|
|
- /**
- * 接口地址
- * 替换为自己的url域名
- */
- export const interfaceUrl = ():void => {
- return apiUrl
- }
- /**
- * @param string text toast提示文字
- * @param number duration 默认:2000毫秒
- * @param bool success 值为true带成功图标,否则无图标
- */
- export const toast = (text:string, success:boolean = false):void => {
- uni.showToast({
- title: text || "出错啦~",
- icon: success ? 'success' : 'none'
- })
- }
- /**
- * @param string title modal框标题文字
- * @param string content moddal框提示内容
- * @param bool showCancel 是否显示取消按钮
- * @param function callback 回调函数
- * @param string confirmColor 确定按钮的颜色,默认是:#5677fc
- * @param string confirmText 确定按钮的文字,默认是:确定
- */
- export const modal = (): void => {
- uni.showModal({
- title: title || '提示',
- content: content,
- showCancel: showCancel,
- cancelColor: "#555",
- confirmColor: confirmColor || "#5677fc",
- confirmText: confirmText || "确定",
- success(res) {
- if (res.confirm) {
- callback && callback(true)
- } else {
- callback && callback(false)
- }
- }
- })
- }
复制代码
|
|