/**
 * Created by chendong on 2017/2/10.
 */
'use strict';

import Vue from 'vue'
import Vuex from 'vuex'
import VueRouter from 'vue-router'
import vueResource from 'vue-resource'
import FrameBody from 'teld-vue-frame/vue/FrameBody.vue'
import { Routes } from '../../teld-router-config'


//全局配置
Vue.config.devtools = false;
Vue.config.errorHandler = function(err, vm) {
    // handle error
    console.error(err);
}

//路由器
Vue.use(Vuex)
Vue.use(VueRouter)
Vue.use(vueResource)

const store = new Vuex.Store({
    state: {
        condition: null
    },
    mutations: {
        updCondition(state, condition) {
            // 变更状态
            state.condition = condition;
        }
    }
})

const router = new VueRouter({
    base: __dirname,
    routes: Routes,
    linkActiveClass: "active"
})

router.beforeEach((to, from, next) => {
    beforeIntoPage(to, from,next);
    next();
})

router.afterEach(route => {
    afterIntoPage(route);
})


const app = new Vue({
    router,
    store,
    render: h => h(FrameBody)
}).$mount('#FrameBody')


