Home > Enterprise >  ES Lint Error When Passing Parameter to Method in Vue
ES Lint Error When Passing Parameter to Method in Vue

Time:01-15

I have an ES Lint Parsing Error in my Vue page. This is occurring because my parameter I am passing to the method contains a "." symbol.

Error - Syntax Error: Unexpected token (1:1628)

<div  v-bind:>

What is the solution to this syntax? Is there a way to escape this in the template file?

Full code can be found here

Thanks in advance for any help!

CodePudding user response:

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  v-bind:>

  •  Tags:  
  • Related