mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:27:07 +00:00
Refactor <dougal-project-settings-name-id/>
This commit is contained in:
@@ -8,14 +8,14 @@
|
||||
label="ID"
|
||||
hint="Short survey ID"
|
||||
persistent-hint
|
||||
v-model="id"
|
||||
v-model="id_"
|
||||
>
|
||||
</v-text-field>
|
||||
<v-text-field
|
||||
label="Name"
|
||||
hint="Survey name"
|
||||
persistent-hint
|
||||
v-model="name"
|
||||
v-model="name_"
|
||||
>
|
||||
</v-text-field>
|
||||
</v-form>
|
||||
@@ -44,31 +44,41 @@
|
||||
export default {
|
||||
name: "DougalProjectSettingsNameId",
|
||||
|
||||
props: [ "value" ],
|
||||
props: {
|
||||
id: String,
|
||||
name: String
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
id: "",
|
||||
name: ""
|
||||
id_: "",
|
||||
name_: ""
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
value (newValue) {
|
||||
this.reset();
|
||||
id () {
|
||||
if (this.id != this.id_) {
|
||||
this.id_ = this.id;
|
||||
}
|
||||
},
|
||||
|
||||
name () {
|
||||
if (this.name != this.name_) {
|
||||
this.name_ = this.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
reset () {
|
||||
for (const key of Object.keys(this.$data)) {
|
||||
this[key] = this.value[key];
|
||||
}
|
||||
this.id_ = this.id;
|
||||
this.name_ = this.name;
|
||||
},
|
||||
|
||||
save () {
|
||||
this.$emit('input', {...this.$data});
|
||||
this.$emit('input', {id: this.id_, name: this.name_});
|
||||
},
|
||||
|
||||
back () {
|
||||
|
||||
Reference in New Issue
Block a user