main.js 1.26 KB
Newer Older
张成 committed
1
import App from './App';
zhangpeng committed
2
//引入vuex
张成 committed
3 4
import store from './store';
import utils from './utils/utils';
zhangcheng committed
5

zhangpeng committed
6
// console.log(Vue.$u,22)
zhangpeng committed
7 8
// 需要在Vue.use(uView)之后执行
// #ifndef VUE3
张成 committed
9
import Vue from 'vue';
10
import Vuex from 'vuex'
zhangcheng committed
11
import uView from 'uview-ui';
张成 committed
12 13
import User from '@/request/user';

14 15 16
// main.js
import initToast from "@/components/bocft-toast/initToast.js"
import showToast from "@/components/bocft-toast/bocft-toast.vue"
songbingqi committed
17
import taBar from "@/components/tabBar/tabBar.vue"
18 19 20

initToast(Vue);
Vue.component('show-toast',showToast);
songbingqi committed
21
Vue.component('taBar',taBar);
22 23


zhangcheng committed
24
Vue.use(uView);
张成 committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38
Vue.prototype.$utils = utils;
Vue.prototype.setPrice = (price) => price && Number(price).toFixed(2);

Vue.prototype.loginByPhoneNumber = (e) => {
  if (e.detail.errMsg == 'getPhoneNumber:ok') {
    User.getPhoneNumber(e);
  } else if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
    uni.showToast({ title: '已拒绝手机号授权', icon: 'error' });
  }
};

Vue.config.productionTip = false;

App.mpType = 'app';
zhangpeng committed
39
const app = new Vue({
张成 committed
40 41 42
  ...App,
  store,
});
43
export default app
张成 committed
44 45
app.$mount();
require('./request/index')(app);
zhangpeng committed
46 47 48
// #endif

// #ifdef VUE3
张成 committed
49
import { createSSRApp } from 'vue';
zhangpeng committed
50
export function createApp() {
张成 committed
51
  const app = createSSRApp(App);
zhangpeng committed
52
  return {
张成 committed
53 54
    app,
  };
zhangpeng committed
55
}
张成 committed
56
// #endif