Skip to content

Instantly share code, notes, and snippets.

@webislife
Created April 18, 2019 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webislife/3d5191590c21abc973b491e44bd20711 to your computer and use it in GitHub Desktop.
Save webislife/3d5191590c21abc973b491e44bd20711 to your computer and use it in GitHub Desktop.
import Vue from 'vue';
import VueRouter from 'vue-router';
import Vuex from 'vuex';
import App from './app.vue';
import { createRouter } from '@client/router.js';
import { createStore } from './store/store.js';
import { sync } from 'vuex-router-sync';
Vue.use(VueRouter);
Vue.use(Vuex);
//API
import {MainApi} from '@client/api/main';
// import global components
import IconComponent from '@components/icon.vue';n.vue';
Vue.component('icon', IconComponent);
class MyApp {
constructor () {
/**
* @property {Vuex} Store - main application storage
*/
this.Store = createStore();
/**
* @property {VueRouter} Router - main client application router
*/
this.Router = createRouter();
//Синхронизирум хранилище и роутер
sync(this.Store, this.Router);
/**
* @property {Vue} Vue - main vue application
*/
this.Vue = new Vue({
router: this.Router,
store: this.Store,
render: h => h(App),
});
/** @property {Object} API main api instance */
this.API = new MainApi();
}
}
export function createApp () {
return new MyApp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment