uses the element framework. Use the watch of vue to listen for selectValue changes. When the changes occur, the click (), of input [type=file] is triggered but has no effect.
html related codes
<el-select v-model="selectValue" placeholder="">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<input type="file" ref="inputFile" id="inputFile">
vue related codes
data () {
return {
options:[{
value: "1",
label: ""
}, {
value: "2",
label: ""
},],
selectValue:""
}
},
watch: {
selectValue: function(v) {
// this.$refs.inputFile.click()
// document.getElementById("inputFile").click()
}
}