84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
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.