i have tried about open file input with button . but, when i click the button client said: "this.$refs.image.click" and this is my code
<v-btn
height="50"
width="180"
color="#6C63FF"
class="mx-8 my-4"
@click="selectFile()"
>
<v-icon color="white"> mdi-image-plus </v-icon></v-btn
>
<input
ref="image"
type="file"
accept="image/*"
style="display: none"
@change="getFileImage"
multiple
/>
</v-col>
methods: {
selectFile() {
this.$refs.image.click()
},
}
Its working fine, pls crosscheck your code with the below code
var app = new Vue({
el: '#app',
vuetify: new Vuetify(),
methods: {
openModal() {
this.$refs.image.click();
}
}
});
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@6.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
<div id="app">
<v-app>
<v-main>
<v-container>
<v-btn
height="50"
width="180"
color="#6C63FF"
class="mx-8 my-4"
@click="openModal()"><v-icon color="white"> mdi-image-plus </v-icon></v-btn>
<input ref="image"
type="file"
accept="image/*"
style="display: none" style="display: none" multiple/>
</v-container>
</v-main>
</v-app>
</div>
</body>
</html>