How to extract the method in the picture and make it into a public part
Write this in methods when instantiating Vue in main.js, and then call $root.link when calling it elsewhere.
methods
$root.link
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.
App.vue
Write this in
methods
when instantiating Vue in main.js, and then call$root.link
when calling it elsewhere.It’s not written in
App.vue
, thank you @kokradoc for the correction.