12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import App from './App'
- // #ifndef VUE3
- import Vue from 'vue'
- Vue.config.productionTip = false
- App.mpType = 'app'
- try {
- function isPromise(obj) {
- return (
- !!obj &&
- (typeof obj === "object" || typeof obj === "function") &&
- typeof obj.then === "function"
- );
- }
- // 统一 vue2 API Promise 化返回格式与 vue3 保持一致
- uni.addInterceptor({
- returnValue(res) {
- if (!isPromise(res)) {
- return res;
- }
- return new Promise((resolve, reject) => {
- res.then((res) => {
- if (res[0]) {
- reject(res[0]);
- } else {
- resolve(res[1]);
- }
- });
- });
- },
- });
- } catch (error) {}
- //import Permission from './directive/permission.js'
- //Vue.use(Permission)
- import system from '@/utils/system.js'
- Vue.mixin(system);
- import CusHeader from '@/components/CusHeader'
- Vue.component('CusHeader',CusHeader);
- import btnPermission from './directive/permission.js';
- import api from '@/http/index.js'
- Vue.prototype.$has = btnPermission;
- Vue.prototype.$api = api;
- Vue.prototype.$imgBase = "http://106.54.209.120:8666/image/";
- //重载uni.showToast,简化调用
- Vue.prototype.$showToast = function(title, duration = 2000, icon = "none") {
- return uni.showToast({
- title,
- duration,
- icon
- })
- }
- //重载uni.showModal,简化调用
- Vue.prototype.$showModal = function(content) {
- return uni.showModal({
- title:'温馨提示',
- content,
- showCancel:false,
- confirmText: '确定',
- confirmColor: '#007A69'
- })
- }
- // 引入全局uView
- import uView from '@/uni_modules/uview-ui'
- Vue.use(uView)
- uni.$u.config.unit = 'rpx'
- const app = new Vue({
- ...App
- })
- app.$mount()
- // #endif
- // #ifdef VUE3
- import {
- createSSRApp
- } from 'vue'
- export function createApp() {
- const app = createSSRApp(App)
- return {
- app
- }
- }
- // #endif
|