123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import Vue from 'vue'
- import store from './store'
- import App from './App'
- import * as Api from '@/common/config/caimeiApi.js'
- import * as Regs from '@/common/config/common.js'
- // import '@/common/utils/module.js'
- import Json from './json' //本地数据
- import cuCustom from './components/cm-custom/cu-custom.vue'
- import cmCustom from './components/cm-custom/cm-custom.vue'
- Vue.component('cu-custom',cuCustom)
- Vue.component('cm-custom',cmCustom)
- /**
- * 示例使用了uni.scss下的变量, 除变量外已尽量移除特有语法,可直接替换为其他预处理器使用
- */
- const msg = (title, duration=1500, mask=true, icon='none')=>{
- //统一提示方便全局修改
- if(Boolean(title) === false){return;}
- uni.showToast({
- title,
- duration,
- mask,
- icon
- });
- }
- 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()
- }
- }
- });
- }
- const json = type=>{
- //模拟异步请求数据
- return new Promise(resolve=>{
- setTimeout(()=>{
- // console.log(resolve+'======='+type);
- resolve(Json[type]);
- }, 500)
- })
- }
- const prePage = ()=>{
- let pages = getCurrentPages();
- let prePage = pages[pages.length - 2];
- // #ifdef H5
- return prePage;
- // #endif
- return prePage.$vm;
- }
- Vue.prototype.$getStorage = function(key){
- var userParam = uni.getStorageSync(key);
- if (userParam != null && userParam != "" && userParam!= undefined) {
- return userParam;
- }else{
- return null;
- }
- }
- Vue.config.productionTip = false
- Vue.prototype.$fire = new Vue();
- Vue.prototype.$store = store;
- Vue.prototype.$util = {msg, json, prePage,modal};
- Vue.prototype.$api = Api;
- Vue.prototype.$reg = Regs;
- App.mpType = 'app'
- const app = new Vue({
- ...App
- })
- app.$mount()
|