fontawesome-vue组件图标切换无法正常工作

时间:2018-11-07 10:03:40

标签: laravel vue.js font-awesome font-awesome-5

为了更新我在Vue模板上的图标,我使用npm安装了fortawesome / vue-fontawesome,问题是它具有一种奇怪的行为:它切换了一次,然后添加了第二个图标 enter image description here

这是模板代码

<th v-for="(key,i) in columns.slice(0,(columns.length-1))" class="bg-info text-white"
                    v-on:click="sortBy(key)"
                    :class="[ isActive(key) ? 'active' : '',' '+colswidth[i]]">

                    <span v-if="isActive(key)">
                    {{ cols[i] }}
                    <font-awesome-icon
                        v-if="isActive(key)"
                        :icon="sortOrders[key]==-1 ? 'sort-down': 'sort-up'">
                    </font-awesome-icon>
                    </span>
                    <span v-else>
                        {{ cols[i] }}
                    </span>

                </th>

<script>
…
isActive(key){
  if(this.sortKey == key){
    return true;
  }
  return false;
}
…
</script>

您是否遇到过同样的问题,您是如何解决的?感谢您的阅读。

0 个答案:

没有答案
相关问题