File / directory select?
-
I am using quasar with webpack and I want the user to select a file or a directory locally and then save that path to the app settings.
I can only find the Uploader component, but I don’t want to upload anything, since it already exists on disk.
Is there an easy way to trigger the file selection component? Maybe with a QBtn?
I see the <q-input> supports type=“file” but it looks terrible. The button is not styled etc.
-
Figured it out:
<template> <main> <q-field helper="Path to data store"> <q-input clearable v-model="settings.data_path" stack-label="Data storage" /> <input type="file" id="dataPath" v-on:change="setDataPath" ref="fileInput" hidden /> </q-field> <q-btn color="primary" v-on:click="selectPath">Set data path</q-btn> </main> </template>
…
methods: { selectPath () { console.log('Selecting path for data store') this.$refs.fileInput.click() }, setDataPath (file) { this.settings.data_path = file.target.files[0].path } }
-
I’m finding this. Thanks a lot. @Zyme