首页  >  问答  >  正文

避免为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 天前471

全部回复(1)我来回复

  • P粉949848849

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

    我可以解决

    雷雷

    回复
    0
  • 取消回复