Skip to content

Commit 80ae0f9

Browse files
author
Walker Leite
committed
feat(component): add slot
1 parent 747cb19 commit 80ae0f9

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/ic-firebase-uploader/ic-firebase-uploader.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
ref="loader"
1818
multiple
1919
@change="onChangeLoader">
20-
<button class="ic-fb_uploader-btn" @click="onBtnClick">
21-
UPLOAD
22-
</button>
20+
<!-- @slot Override default upload button, you must call promptFiles method -->
21+
<slot><button class="ic-fb_uploader-btn" @click="promptFiles">
22+
UPLOAD
23+
</button></slot>
2324
</div>
2425
</template>
2526

@@ -63,9 +64,6 @@ export default {
6364
sentFiles: [],
6465
}),
6566
methods: {
66-
onBtnClick() {
67-
this.$refs.loader.click()
68-
},
6967
onFileLinkClick(fileRef, event) {
7068
/**
7169
* When user clicks in a file link, event contains
@@ -173,6 +171,12 @@ export default {
173171
.catch(err => this.$emit('error', err))
174172
}
175173
},
174+
/**
175+
* Open the file browser and ask user for the files
176+
*/
177+
promptFiles() {
178+
this.$refs.loader.click()
179+
},
176180
},
177181
}
178182
</script>

0 commit comments

Comments
 (0)