[Vuejs]-Selecting list values depending on another select list values

0👍

Filter templates based on the currently selected publishers:

 <v-flex>
                @can('publish')
                @if (sizeof($publishers) > 1)
                <input type="hidden" :value="publishers" name="publishers">
                <v-select label="Publishers" item-text="name" item-value="id" v-model="publishers" :items="listPublishers" :rules="[rules.required]" multiple chips persistent-hint/>

                <div class="text-danger">{{ $errors->first('publisher_id') }}</div>

                <v-select label="Templates" item-text="name" item-value="id" v-model="templates" :items="listTemplates.filter(tpl => (publishers || []).includes(tpl.publisher_id))" :rules="[rules.required]" multiple chips persistent-hint/>

                <input type="hidden" name="publisher_id">
            </v-flex>

Leave a comment