在我的 vue.js 应用程序中,我试图读取name我传递给我的函数的值。我相信这是一个范围问题。环顾四周,我认为这可以用胖箭头函数解决?
这是我用来处理更改事件的内容。有没有办法
async handleChange(event, name) {
console.log('name: ', name); // works
console.log('value: ', event.value); // works
try {
let response = await axios.patch(`/my/path`, {
name: event.value, // need to get the value from name
});
if (response.status === 200) {
//
} else {
console.error('Error: could not update. ', response);
}
} catch (error) {
console.error('Error: sending patch request. ', error);
}
}
我也试过这个开始:
handleChange: async (event, name) => {
...
}
我只是不确定如何在 axios 补丁中使用粗箭头函数。感谢您的任何建议!
慕田峪7331174
相关分类