使用 vue 资源将 vue 数据作为正文发布请求
<script>
//var VueValidator = require ('vue-validator');
new Vue({
el: '#app',
data: {
email: '',
password: '',
_token: '{{csrf_token()}}',
uid: '{{$row->id}}'
},
methods: {
changeCredentials: function (e) {
console.log(this.email); --> **RETURNS EMPTY**
var resource = this.$resource('myurl/{id}');
resource.save({id: this.uid}, {body: function () {
console.log(this.data);
return this.data;
}}).then((response) => {
// success callback
console.log(response);
}, (response) => {
// error callback
});
//alert('here');
}
}
});
</script>
你能告诉我为什么 this.uid 有效但 this.email 无效吗?谢谢