我很难使用Vue路由传递props .当我把props 带到下一个视图时,我似乎无法访问它们.这是我的目标:
methods: {
submitForm() {
let self = this;
axios({
method: 'post',
url: url_here,
data:{
email: this.email,
password: this.password
},
headers: {
'Content-type': 'application/x-www-form-urlencoded; charset=utf-8'
}
}).then(function(response) {
self.userInfo = response.data;
self.$router.push({name: 'reading-comprehension', props: {GUID:self.userInfo.uniqueID }});
})
}
}
post请求正在工作,但当我try 路由到一个新组件,并在下一个组件中传递props 访问时,它说,
实例上未定义属性或方法"guid",但
顺便说一下,我要路由到的组件如下所示:
<template lang="html">
<div class="grid-container" id="read-comp">
<div class="row">
<h1>Make a sentence:</h1>
{{ GUID }}
</div>
</div>
</template>
<script>
export default {
data(){
return {
props: ['GUID'],
}
}
}