0👍
I Personally wouldn’t use the Blade @if and pass it as JS variables.
<select class="form-control" id="treeType" name="treeType"
v-model="tree" v-on:change="treeType()" >
<option value="0">{{ trans('laravel-tournaments::core.playoff') }}
</option>
<option value="1">{{ trans('laravel-tournaments::core.single_elimination') }}
</option>
</select>
I would then have a the values come back and stored in a JS var.
var treeType = {{ old('tree') ? old('tree') : 0 }};
Then I would pass it when VueJs is created
new Vue({
el: '#app',
data: {
isPrelimDisabled: false,
isGroupSizeDisabled: false,
isAreasDisabled: false,
hasPrelim:0,
tree:1,
},
methods: {
prelim: function(){
if (this.hasPrelim == 0){
this.isGroupSizeDisabled = true;
}else{
this.isGroupSizeDisabled = false;
}
},
treeType: function(){
if (this.tree == 0){
this.isPrelimDisabled = true;
this.isAreaDisabled = true;
}else{
this.isPrelimDisabled = false;
this.isAreaDisabled = false;
}
}
},
created() {
this.tree = treeType;
this.prelim();
this.treeType();
}
})
- [Vuejs]-Vue push unique values to a list
- [Vuejs]-How can I use single file vue component with symfony 4?
Source:stackexchange.com