引入 vue-router.min.js,然后与 Vue 实例绑定即可
例如: http://www.sunzhongwei.com/test_vue?name=zhongwei
var router = new VueRouter({
mode: 'history',
routes: []
});
new Vue({
router,
el: '#my_app',
mounted: function() {
var name = this.$route.query.name;
console.log(name);
},
});