main.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import Vue from 'vue';
  2. import App from './App';
  3. import _mixins from './common/_mixins';
  4. import _common from './common/common';
  5. import _data from './common/_data';
  6. import store from './store';
  7. // 公用
  8. import hxNavbar from "./components/hx-navbar/hx-navbar.vue";
  9. import servingView from "./components/serving-view/index.vue"
  10. Vue.component('serving-view',servingView);
  11. Vue.component('hx-navbar', hxNavbar);
  12. // 关闭生产提示
  13. Vue.config.productionTip = false;
  14. Vue.prototype.$store = store;
  15. // 小程序页面组件和这个`App.vue`组件的写法和引入方式是一致的,为了区分两者,需要设置`mpType`值
  16. App.mpType = 'app';
  17. import { mapState,mapMutations } from 'vuex';
  18. Vue.mixin(_mixins);
  19. Vue.mixin(_common);
  20. Vue.mixin({
  21. data(){
  22. return {
  23. X: 260,
  24. Y: 180,
  25. }
  26. },
  27. onLoad() {
  28. if (this.$initData$) {
  29. Object.assign(this, JSON.parse(this.$initData$))
  30. } else {
  31. this.$initData$ = JSON.stringify(this.$data)
  32. }
  33. },
  34. onShow(){
  35. let dragInfo = getApp().globalData['dragInfo'];;
  36. this.X = dragInfo.moveX;
  37. this.Y = dragInfo.moveY;
  38. }
  39. })
  40. const app = new Vue({
  41. store,
  42. ...App
  43. });
  44. app.$mount();