<template>
<div>
a.vue
<router-link to="/a/a1">a1</router-link>
<router-link to="/a/a2">a2</router-link>
<br>
<button @click="gta1()">a1</button>
<router-view></router-view>
</div>
</template>
<script>
export default{
methods:{
gta1(){
router.push({path:'a'}) //这里报错了, “router is not defined”
}
}
}
</script>
求问,怎么才能获取到router,实现编程式导航?
慕码人8056858
相关分类