Hi guys,
I’m really struggling as I can’t find enough documentation to help me solve that one. I’m pretty sure it’s an easy one but I can’t figure it out (not familiar with vue nor kirby plugins)
My question is how do I send the array from the php to the vue js template and props?
vue.js file
<template>
<k-field
:input="_uid"
v-bind="$props"
class="k-select-field">
<k-input
ref="input"
:id="_uid"
:options="[
{ value: options.value, text: options.text }
]"
theme="field"
v-on="$listeners"
type="select"
/>
</k-field>
</template>
<script>
export default {
props: {
label: String,
help: String,
value: String,
background: String,
options: Array
},
methods: {
onInput(value) {
this.$emit("input", value);
}
}
};
</script>
<style lang="scss">
/** put your css here **/
</style>
index.php
Kirby::plugin('julienmillies/color-selector', [
'fields' => [
'colorselector' => [
'extends' => 'select',
'props' => [
'options' => function (array $options) {
return $options;
}
]
]
]
]);