1、新增ref
<input type="file" ref="uploadFile" />
2、獲取input file
...
setup () {
let uploadFile = ref('uploadFile')
return {
uploadFile
}
3、執行清空操作
setup () {
...
const clearInput = () => {
uploadFile.value.value = ''
}
...
}
<input type="file" ref="uploadFile" />
...
setup () {
let uploadFile = ref('uploadFile')
return {
uploadFile
}
setup () {
...
const clearInput = () => {
uploadFile.value.value = ''
}
...
}