123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import Vue from 'vue'
- import App from '@/App'
- import { router, RouterMount } from '@/router/index.js'
- import LoadingPlugin from '@/plugins/loading.js'
- import '@/utils/filter.js'
- import uView from 'uview-ui'
- // 此处为演示vuex使用,非uView的功能部分
- import store from '@/store'
- import { pcLogin } from './api/user'
- // 引入uView对小程序分享的mixin封装
- const mpShare = require('uview-ui/libs/mixin/mpShare.js')
- // 引入uView提供的对vuex的简写法文件
- import vuexStore from '@/store/$u.mixin.js'
- import { sleep } from './utils/utils'
- Vue.mixin(vuexStore)
- Vue.mixin(mpShare)
- Vue.use(router)
- Vue.use(uView)
- Vue.use(LoadingPlugin)
- Vue.config.productionTip = false
- // 小程序页面组件和这个 App.vue 组件的写法和引入方式是一致的,为了区分两者,需要设置mpType值
- App.mpType = 'app'
- pcLogin().then((res) => {
- uni.setStorageSync('user', res)
- })
- const app = new Vue({
- store,
- ...App
- })
- //v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
- // #ifdef H5
- RouterMount(app, router, '#app')
- // #endif
- // #ifndef H5
- app.$mount() //为了兼容小程序及app端必须这样写才有效果
- // #endif
- export default app
|