problem description
recently found a problem that neither value="value_1" nor v-modle can clear the value in the < input type="file" > tag. If ref is OK, but in this case, it violates the principle of not directly manipulating the real dom. Is there any solution?
related codes
/ / Please paste the code text below (do not replace the code with pictures)
< template >
<input type="file" :value="vaule_1" ref="inputFile">
<button @click="reset"></button>
< / div >
< / template >
< script >
export default {
data() {
return {
value_1: ""
}
},
methods: {
reset() {
this.value_1 = ""
// this.$refs.inputFile = ""
},
}
}
< / script >