main.js 668 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. Vue.prototype.$store = store
  10. /**
  11. * 获取用户信息
  12. */
  13. Vue.prototype.$getUser = function() {
  14. return uni.getStorageSync('user');
  15. }
  16. /**
  17. * 判断是否登陆
  18. */
  19. Vue.prototype.$hasLogin = () => {
  20. if (uni.getStorageSync('user') === '' || uni.getStorageSync('user') === null) {
  21. return false
  22. } else {
  23. return true
  24. }
  25. }
  26. App.mpType = 'app'
  27. const app = new Vue({
  28. store,
  29. ...App
  30. })
  31. app.$mount()