fontawesome-vue component icon toggle doesn't work properly

161 Views Asked by At

in order to update my icons on my Vue template I installed fortawesome/vue-fontawesome with npm, the problem is that it has a strange behavior: it' toggling one time and after it adds a second icon enter image description here

Here is the template code

<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>

Did you had the same problem, and how did you resolve it ? Thanks for reading.

0

There are 0 best solutions below