<file_sep>import Vue from 'vue'
import App from './App'

import VueRouter from 'vue-router'
import VueResource from 'vue-resource'

//路由
import Message from './views/message.vue'
import Search from './views/search.vue'
import Me from './views/me.vue'
import Home from './views/home.vue'

import pullToRefresh from './directives/pullToRefresh';

Vue.use(VueRouter);
Vue.use(VueResource);

//directive 自定义指令
Vue.directive('pullToRefresh', pullToRefresh);

const router = new VueRouter({
    mode: 'history',
    saveScrollPosition : true, //当用户点击后退时用popstate事件相应
    routes: [
        // a single route can define multiple named components
        // which will be rendered into <router-view>s with corresponding names.
        {path: '/', components: {default: Home,}},
        {path: '/home', components: {default: Home,}},
        {path: '/search', components: {default: Search}},
        {path: '/message', components: {default: Message}},
        {path: '/me', components: {default: Me}}
    ]
})

window.router = router;

/* eslint-disable no-new */
new Vue({
    router,
    el: '#app',
    template: '<app/>',
    components: {App}
}).$mount('#app')



<file_sep>import Vue from 'vue'
import App from './App'
//import VueRouter from 'vue-router'
//import routerConfig from './router'


/* eslint-disable no-new */
new Vue({
  el: '#app',
  template: '<App/>',
  components: { App }
})

// Router
/*Vue.use(VueRouter);

var router = new VueRouter(
    {
      hashbang: true,  //为true的时候 example.com/#!/foo/bar ， false的时候 example.com/#/foo/bar
      //abstract:true,  //地址栏不会有变化
      //以下设置需要服务端设置
      //history: false,   //当使用 HTML5 history 模式时，服务器需要被正确配置 以防用户在直接访问链接时会遇到404页面。
      //saveScrollPosition: false
      linkActiveClass:'custom-active-class' //全局设置连接匹配时的类名 参考http://vuejs.github.io/vue-router/en/link.html
    }
);
routerConfig(router);

router.start(App, '#app');

window.router = router;*/

