61 lines
1 KiB
Vue
61 lines
1 KiB
Vue
<template>
|
|
<k-field class="bg-red" v-bind="$props">
|
|
<k-form :fields="computedFields" v-model="localValue" @input="update" />
|
|
</k-field>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
value: Object,
|
|
options: Array,
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
localValue: this.value || {}
|
|
};
|
|
},
|
|
|
|
computed: {
|
|
computedFields() {
|
|
const fields = {};
|
|
|
|
if (this.options.includes("summary")) {
|
|
fields.summary = {
|
|
label: "Inclure le sommaire",
|
|
type: "toggle"
|
|
};
|
|
}
|
|
|
|
if (this.options.includes("page-number")) {
|
|
fields.pageNumber = {
|
|
label: "Afficher la numérotation",
|
|
type: "toggle"
|
|
};
|
|
}
|
|
|
|
if (this.options.includes("cover")) {
|
|
fields.cover = {
|
|
label: "Inclure la couverture",
|
|
type: "toggle"
|
|
};
|
|
}
|
|
|
|
return fields;
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
update() {
|
|
this.$emit("input", this.localValue);
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
.bg-red{
|
|
border: solid red 2px;
|
|
}
|
|
</style>
|