下面代码报错了,求大神解答
Uncaught TypeError: Cannot read property 'post' of undefined
at VueComponent.submit (eval at (app.js:860), :24:14)
at Proxy.boundFn (eval at (app.js:765), :125:14)
at submit (eval at (app.js:1148), :10:13)
{{ machine_name }}
export default {
data() {
return {
machine_name: ''
};
},
computed: {
get_machine_list() {
return ['fd-11', 'fd-12', 'fd-13'];
}
},
methods: {
submit: function() {
var formData = JSON.stringify(this.$refs.selectedMachine.value);
this.$http.post('/path/to', formData).then((response) => {
// success callback
}, (response) => {
// error callback
});
}
}
}