You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

54 lines
1.1 KiB

import Vue from 'vue'
import App from './App'
import * as $api from './common/api'
import $util from './common/util'
import hypIcon from './components/hyp-icon/hyp-icon'
import hypImage from './components/hyp-image/hyp-image'
Vue.prototype.$api = $api
Vue.prototype.$util = $util
import Json from './Json' //测试用数据
Vue.component('hyp-icon', hypIcon)
Vue.component('hyp-image', hypImage)
//模拟接口,获取本地数据
const msg = (title, duration=1500, mask=false, icon='none')=>{
//统一提示方便全局修改
if(Boolean(title) === false){
return;
}
uni.showToast({
title,
duration,
mask,
icon
});
}
const json = type=>{
//模拟异步请求数据
return new Promise(resolve=>{
setTimeout(()=>{
resolve(Json[type]);
}, 500)
})
}
const prePage = ()=>{
let pages = getCurrentPages();
let prePage = pages[pages.length - 2];
// #ifdef H5
return prePage;
// #endif
return prePage.$vm;
}
Vue.config.productionTip = false
Vue.prototype.$testapi = {msg, json, prePage};
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()