I have a custom component:
<template>
<div class="form-group">
<label for="desc">{{label}}</label>
<input id="desc" type="text" class="form-control input-sm"
:name="label"
:readonly="readonly"
v-bind:value="value"
v-on:input="$emit('input', $event.target.value)"
v-validate="validate"
/>
<div class="error-feedback">{{ errors.first(label) }}</div>
{{readonly}}<!-- debugging -->
</div>
</template>
<script>
export default {
name: 'FormGroup',
props: {
label: String,
value: String,
readonly: String,
validate: String
},
data: function() {
return {
}
}
}
</script>
<style scoped>
.error-feedback {
color: #cc3333;
}
</style>
When I call it with:
<FormGroup label="Channel" readonly="device_config.enabled" validate="required" v-model="device_config.some_setting" />
The custom component receives the 'readonly' property as the literal string "device_config.some_setting" rather than the value contained in device_config.some_setting.
How can I get my custom component to make field readonly dependent on a value in the calling component's model which is passed-in?