How to avoid adding class="" to the last element of a Vue.js loop
P粉868586032
P粉868586032 2023-08-29 14:28:06
0
1
524
<p>In vuejs template, remove tailwind class when looping the last iteration of index. </p> <p><strong>In template</strong></p> <pre class="brush:php;toolbar:false;">v-for="(service, index) in getAllServices.home_page_services" :key="index"</pre> <p><strong>In script</strong></p> <pre class="brush:php;toolbar:false;"><script> export default { mounted() { this.$store.dispatch("getHomePageContent") }, computed: { getAllServices(){ return this.$store.getters.getContentFormGetters } } }</pre></p>
P粉868586032
P粉868586032

reply all(1)
P粉949848849

i can solve it

:class="{ 'lg:border-r-2 lg:border-blue-650': index < getAllServices.home_page_services.length - 1 }"
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template