the code is as follows:
const homepage = {template: "-sharphome-page",mounted:function () {
vm.homeInit()
}};
const router = new VueRouter({
routes: [
{path: "/", component: homepage},
{path: "/process", component: process},
{path: "/feature", component: feature}
]
});
const vm = new Vue({
el: "-sharpapp",
data:{
name : 1
},
router,
methods: {
homeInit: function () {
console.log("1");
}
}
});
When switches to "/", the method can execute (see figure)
but keep reporting wrong: vm is not defined,. Excuse me, what is it?