main.js 734 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import Vue from 'vue'
  2. import App from './App'
  3. import http from './common/http.js'
  4. import verify from './common/graceChecker.js' //数据验证
  5. import store from './store'
  6. Vue.config.productionTip = false
  7. Vue.prototype.$http = http;
  8. Vue.prototype.$verify = verify;
  9. // 引入全局uView
  10. import uView from 'uview-ui'
  11. Vue.use(uView)
  12. Vue.prototype.$store = store
  13. /**
  14. * 获取用户信息
  15. */
  16. Vue.prototype.$getUser = function() {
  17. return uni.getStorageSync('user');
  18. }
  19. /**
  20. * 判断是否登陆
  21. */
  22. Vue.prototype.$hasLogin = () => {
  23. if (uni.getStorageSync('user') === '' || uni.getStorageSync('user') === null) {
  24. return false
  25. } else {
  26. return true
  27. }
  28. }
  29. App.mpType = 'app'
  30. const app = new Vue({
  31. store,
  32. ...App
  33. })
  34. app.$mount()