Files
ocis/ui/components/settings/SettingBoolean.vue
T
Benedikt Kulmann e44654dc9d Integrate loaded settings values into ui
Not yet done for single choice and multi choice, but getting there...
2020-05-07 07:42:50 +02:00

53 lines
1.0 KiB
Vue

<template>
<div>
<oc-checkbox v-model="value" :label="setting.boolValue.label" />
</div>
</template>
<script>
import isNil from "lodash/isNil"
export default {
name: 'SettingBoolean',
props: {
bundle: {
type: Object,
required: true
},
setting: {
type: Object,
required: true
},
persistedValue: {
type: Object,
required: false
}
},
data() {
return {
initialValue: null,
value: null
}
},
computed: {
isChanged() {
return this.initialValue !== this.value
}
},
methods: {
applyValue() {
// TODO: propagate value to parent
// TODO: show a spinner while the request for saving the value is running!
}
},
mounted() {
if (!isNil(this.persistedValue)) {
this.value = this.persistedValue.boolValue
}
if (isNil(this.value) && !isNil(this.setting.boolValue.default)) {
this.value = this.setting.boolValue.default
}
this.initialValue = this.value
}
}
</script>