ES Lint Error When Passing Parameter to Method in Vue

Solution 1:

Define highlight as a computed property which returns a function that takes the price as parameter :


    computed:{
      highlight(){
        return (priceChange)=>{
        if(priceChange < 0)
        {
          return 'text-red-900'
        }
        if(priceChange > 0)
        {
          return 'text-green-900'
        }
        return '';
       }
      }
    },

and bind it to the class without using {} :

<div class="..." v-bind:class="highlight(coin.price_change_percentage_24h)">