How to extract the method in the picture and make it into a public part
给我你的怀抱2017-06-26 10:52:30
Write this in methods
when instantiating Vue in main.js, and then call $root.link
when calling it elsewhere.
var app = new Vue({
el: '#app',
router,
components: {App},
template: '<App />',
methods: {
link: function(to) { ... }
},
...
});
It’s not written in App.vue
, thank you @kokradoc for the correction.