main.js 1.2 KB

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