这里写自定义目录标题
将路由跳转挂在原型上
//min.js
import router from ‘./router’
Vue.prototype.toPath = function (path) {
this.$router.push(path);
};
new Vue({
el: ‘#app’,
router,
components: { App},
template: ‘’
});
这时候我们就可以在别的组件直接调用了
methods: {
jump: function () {
this.toPath("/");
}
}