mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-08-05 03:57:03 -04:00
43 lines
941 B
Vue
43 lines
941 B
Vue
<template>
|
|
<div v-if="hasChanges" class="form-check form-switch my-2">
|
|
<label>
|
|
<input v-model="propagate" class="form-check-input" type="checkbox" role="switch">
|
|
<T>profile.editor.propagate</T>
|
|
</label>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
field: { required: true },
|
|
before: { required: true },
|
|
after: { required: true },
|
|
},
|
|
emits: ['change'],
|
|
data() {
|
|
return {
|
|
propagate: false,
|
|
};
|
|
},
|
|
computed: {
|
|
hasChanges() {
|
|
return JSON.stringify(this.before) !== JSON.stringify(this.after);
|
|
},
|
|
},
|
|
watch: {
|
|
hasChanges() {
|
|
this.emit();
|
|
},
|
|
propagate() {
|
|
this.emit();
|
|
},
|
|
},
|
|
methods: {
|
|
emit() {
|
|
this.$emit('change', this.field, this.hasChanges && this.propagate);
|
|
},
|
|
},
|
|
};
|
|
</script>
|