比如这里有个表单demo:
用vue提交表单:
new Vue({
el: '#app',
methods: {
submit: function(event) {
var formData = new FormData(event.target);
this.$http.post('/path/to', formData).then((response) => {
// success callback
}, (response) => {
// error callback
});
}
}
})
问题:
点击提交的时候,显示如下错误:Uncaught TypeError: Cannot read property 'target' of undefined,怎么个意思?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
试试?
你的
formData是错误的,试试下面这样获取表单数据吧。你好..如果是input的类型是file要怎么获取啊?