[Vuejs]-Change the template accoding to publisher selection in vue js

0👍

Filter templates based on the currently selected publisher:

<v-flex>
   @can('publish')
   @if (sizeof($publishers) > 1)
   <input type="hidden" :value="selectedPublisher" name="publishers">
   <v-select label="Publishers" item-text="name" item-value="id" v-model="selectedPublisher" :rules="[rules.required]" chips persistent-hint>
   </v-select>
        <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 => selectedPublisher === tpl.publisher_id)" :rules="[rules.required]" chips persistent-hint/>
        <input type="hidden" name="publisher_id">
   </v-text-field>               
</v-flex>

Leave a comment