Difference between revisions of "Main.js File"
Jump to navigation
Jump to search
Line 31: | Line 31: | ||
render: h => h(App) | render: h => h(App) | ||
})</pre> | })</pre> | ||
[[VueJs Routing]] |
Latest revision as of 18:05, 17 October 2018
import Vue from 'vue' import App from './App.vue' import VueRouter from 'vue-router'; import { myRoutes } from './routes.js'; Vue.use(VueRouter); const router = new VueRouter({ routes: myRoutes, mode: 'history', scrollBehavior(to, from, savedPosition){ if(savedPosition){ return savedPosition; } if(to.hash){ return{selector: to.hash}; } //return{x:0 , y:700}; } }); // get executed on each routing action router.beforeEach((to, from, next) =>{ console.log('Global before each'); next(); }); new Vue({ el: '#app', router, render: h => h(App) })