12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- // #ifndef VUE3
- import Vue from 'vue'
- import App from './App'
- //导入网络请求包
- import {$http} from '@escook/request-miniprogram'
- //5.导入store的自定义模块
- import store from '@/information/store.js'
- //导入uView组件库
- import uView from '@/uni_modules/uview-ui'
- Vue.use(uView)
- //挂载到uni.$http上方便调用
- uni.$http = $http
- //请求根路径
- // $http.baseUrl = 'https://www.uinav.com'
- //挂载请求拦截器
- $http.beforeRequest = function(options) {
- uni.showLoading({
- title: '数据加载中...'
- })
- }
- //挂载响应拦截器
- $http.afterRequest = function() {
- uni.hideLoading()
- }
- //封装的展示消息提示方法
- uni.$showMsg = function(title = '请求失败', duration = 1500){
- uni.showToast({
- title,
- duration,
- icon: 'none'
- })
- }
- Vue.config.productionTip = false
- App.mpType = 'app'
- //app实例对象
- const app = new Vue({
- ...App,
- //6.挂载到app实例对象里
- store
- })
- app.$mount()
- // #endif
- // #ifdef VUE3
- import { createSSRApp } from 'vue'
- import App from './App.vue'
- export function createApp() {
- const app = createSSRApp(App)
- return {
- app
- }
- }
- // #endif
|