首頁  >  問答  >  主體

避免為Vue.js循環的最後一個元素加入class=""的方法

<p>在vuejs範本中,當循環索引的最後一次迭代時,刪除tailwind類別。 </p> <p><strong>在範本中</strong></p> <pre class="brush:php;toolbar:false;">v-for="(service, index) in getAllServices.home_page_services" :key="index"</pre> <p><strong>在劇本中</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粉868586032P粉868586032416 天前475

全部回覆(1)我來回復

  • P粉949848849

    P粉9498488492023-08-30 10:00:49

    i can solve it

    :class="{ 'lg:border-r-2 lg:border-blue-650': index < getAllServices.home_page_services.length - 1 }"

    回覆
    0
  • 取消回覆