Skip to content

Commit

Permalink
feat(file-uploader): expose file items manipulation methods
Browse files Browse the repository at this point in the history
Expose setState, clear and setInvalidMessage to parent components
  • Loading branch information
felipebritor committed Aug 15, 2023
1 parent 6a69c6f commit e59e499
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/components/CvFileUploader/CvFileUploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,23 @@ function onKeyHit() {
onMounted(() => {
internalFiles.value = props.modelValue || [];
});
// exposed methods
defineExpose({
setState(index, state) {
if ([STATES.COMPLETE, STATES.UPLOADING, STATES.NONE].includes(state)) {
internalFiles.value[index].state = state;
}
},
clear() {
internalFiles.value = [];
emit('update:modelValue', internalFiles);
},
setInvalidMessage(index, message) {
internalFiles.value[index].invalidMessage = message;
},
remove: onItemRemove,
});
</script>
<script>
Expand Down

0 comments on commit e59e499

Please sign in to comment.