12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /* 常用工具函数 */
- export const msg = (title, duration = 1500, mask = true, icon = 'none') => {
- //统一提示方便全局修改
- if (Boolean(title) === false) {
- return
- }
- uni.showToast({
- title,
- duration,
- mask,
- icon
- })
- }
- export const modal = (title, content, confirmText, cancelText, showCancel = false, callBack) => {
- uni.showModal({
- title,
- content,
- confirmText,
- cancelText,
- confirmColor: '#E15616',
- showCancel,
- success: function(res) {
- if (res.confirm) {
- callBack()
- }
- }
- })
- }
- export const json = type => {
- //模拟异步请求数据
- return new Promise(resolve => {
- setTimeout(() => {
- // console.log(resolve+'======='+type);
- resolve(Json[type])
- }, 500)
- })
- }
- export const prePage = () => {
- let pages = getCurrentPages()
- let prePage = pages[pages.length - 2]
- // #ifdef H5
- return prePage
- // #endif
- return prePage.$vm
- }
|