nextcloud-libraries / nextcloud-vue

🍱 Vue.js components for Nextcloud app development ✌ https://npmjs.org/@nextcloud/vue
https://nextcloud-vue-components.netlify.app/
Other
215 stars 85 forks source link

Allow input type file for NcActionInput #4339

Open feefladder opened 1 year ago

feefladder commented 1 year ago

I want to make an app that does some preprocessing on files before uploading to Nextcloud. For this, I need a file input. However, the NcActionInput does not support type=file:

<NcActionInput
        type="file"
        accept=".csv"
        @submit="$emit('upload-file', $event)">
        <template #icon>
            <UpIcon />
        </template>
</NcActionInput>

<script>
import NcActionInput from '@nextcloud/vue/dist/Components/NcActionInput.js'
import UpIcon from 'vue-material-design-icons/ArrowUpThin.vue'
</script>

image image

I would be happy to PR if people think it is a good idea

szaimen commented 1 year ago

cc @nextcloud/vuejs

skjnldsv commented 1 year ago

Not too convinced tbh. Feels like a specific use case, not sure we'll use it anywhere else But you can easily go around that with a input for binding and another input type file somewhere in your template.

feefladder commented 1 year ago

That's what I did in the end. Also I didn't exactly realize that v-model doesn't work on file, while it does work on the rest, so that may be a reason why not to use it.