I have vue component like this :
<script>
export default{
template: '\
<select class="form-control" v-on:change="search">\
<option v-for="option in options" v-bind:value="option.id ? option.id+\'|\'+option.name : \'\'">{{ option.name }}</option>\
</select>',
mounted() {
this.fetchList();
},
...
};
</script>
It works. No error
But, I want to add condition again in select
If it meets the conditions then selected
I add condition like this :
template: '\
<select class="form-control" v-on:change="search">\
<option v-for="option in options" v-bind:value="option.id ? option.id+\'|\'+option.name : \'\'" option.id == 1 ? \'selected\' : \'\'>{{ option.name }}</option>\
</select>',
There exist error like this :
[Vue warn]: Property or method "option" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.
How can I solve it?