Refactor <dougal-project-settings-file-path/>

This commit is contained in:
D. Berge
2023-11-13 21:12:45 +01:00
parent 7ab6be5c67
commit ad48ac9998

View File

@@ -8,11 +8,11 @@
label="Project folder"
hint="Root file path for this project"
persistent-hint
v-model="path"
v-model="rootPath_"
>
<dougal-file-browser-dialog
slot="append"
v-model="path"
v-model="rootPath_"
mimetypes="inode/directory"
></dougal-file-browser-dialog>
</v-text-field>
@@ -45,30 +45,32 @@ export default {
components: { DougalFileBrowserDialog },
props: [ "value" ],
props: [ "rootPath" ],
data () {
return {
path: ""
rootPath_: ""
}
},
watch: {
value (newValue) {
this.reset();
rootPath () {
if (this.rootPath != this.rootPath_) {
this.reset();
}
}
},
methods: {
reset () {
for (const key of Object.keys(this.$data)) {
this[key] = this.value[key];
}
this.rootPath_ = this.rootPath;
},
save () {
this.$emit('input', {...this.$data});
this.$emit('input', {rootPath: this.rootPath_});
},
back () {