请看下面我的代码。我的input工作正常,但不是v-file-input:
<v-file-input
accept=".json"
ref="loadedFile"
label="Upload file"
@change="checkJSON"
></v-file-input>
<input
type="file"
accept=".json"
@change="checkJSON"
>
methods: {
checkJSON: function(e) {
console.log("JSON checking")
console.log(JSON.stringify(e))
console.log(e.target.files)
return
}
}
Run Code Online (Sandbox Code Playgroud)
控制台显示 的文件input,但这是我收到的消息v-file-input:
[Vue warn]: Error in v-on handler: "TypeError: e.target is undefined"
Run Code Online (Sandbox Code Playgroud)
这是正常的吗?我想使用 vuetify 组件,它更漂亮。提前致谢。
根据Vuetify doc to v-file-input,@change事件有 1 个参数,它是一个文件数组。
checkJSON: function(files) {
console.log(files)
}
Run Code Online (Sandbox Code Playgroud)
此事件@change与您的输入不同。
| 归档时间: |
|
| 查看次数: |
2491 次 |
| 最近记录: |