刚开始使用Laravel的vuejs,我试图使用axios http客户端库进行发布请求。 请求工作正常,但我不能够显示HTML文件中的错误消息。Vuejs:ajax验证错误消息不显示
下面是HTML文件
Submit
//for showing errors
{{error}}
的js
export default {
data:function(){
return {
test:'hello',
more:[
{ message: 'Foo' },
{ message: 'Bar' }
],
origin:'',
user:{},
error:''
}
},
methods:{
addJob:function(e){
axios.post('/test',this.user)
.then(function (response) {
//set the error message
this.$set('error',response.data.errors);
//this will returns nothing
console.log(error);
})
.catch(function (error) {
});
}
}
}
然而response.data.errors返回的错误信息,但我不能能够HTML页面中显示。这
2017-02-22
Jabaa