我有以下index.html
{ "status": "success",
"employee": [
{
"EmployeeID": 17,
"FirstName": "jak",
"LastName": 123,
"Team": "ok"
},
{
"EmployeeID": 18,
"FirstName": "jak",
"LastName": 123,
"Team": "ok"
},
{
"EmployeeID": 19,
"FirstName": "jak",
"LastName": 123,
"Team": "ok"
}]
}
在模板文件中,我在" /"
中加载以下内容<html>
....
<section id="#section">
<router-view></router-view>
</section>
</html>
我有以下路线图
<div>
<a v-on:click="go()">GO</a>
</div>
<script>
export default {
methods: {
go: function () {
this.$router.go("/app")
}
}
}
</script>
点击链接似乎无法更改视图。我不确定我做错了什么。
即使使用
route.map({
'/': {component: a},
"/app": {component:b}
})
route.start(a,"#section")
似乎没有效果。
答案 0 :(得分:-1)
<script>
export default {
methods: {
go: function () {
this.$router.go("/app")
}
}
}
</script>
我认为它应该是this.$router.go
,而不是this.$route.router.go
看起来你正在调用错误的组件。它应该是<router-view></router-view>
而不是<route-view></route-view>