file input event

This commit is contained in:
Novembert 2021-12-09 18:07:25 +01:00
parent ec7b8f4cf0
commit 03aee6d36e
2 changed files with 7 additions and 1 deletions

View File

@ -81,6 +81,7 @@ export default {
this.url = URL.createObjectURL(file) this.url = URL.createObjectURL(file)
this.name = file.name this.name = file.name
this.file = file this.file = file
this.$emit('set', { file: this.file, url: this.url })
} catch (e) { } catch (e) {
this.url = null this.url = null
this.name = null this.name = null

View File

@ -2,12 +2,17 @@
<div> <div>
<Button text="Hello World" :icon="['fas', 'undo']" @click.native="submitPhoto" /> <Button text="Hello World" :icon="['fas', 'undo']" @click.native="submitPhoto" />
<Button text="Without Icon" /> <Button text="Without Icon" />
<InputFile label="Twój obrazek" /> <InputFile label="Twój obrazek" @set="(value) => photo = value" />
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data () {
return {
photo: null
}
},
methods: { methods: {
submitPhoto () { submitPhoto () {
console.log('test') console.log('test')