Monday, 15 October 2018

Vuejs 2 impossible to interpolate attribute values

 <th :class="{'c-' + column, active: sortKey == column}"
      v-for="column in getColumns()" @click="sortBy(column)">
            
 </th>

I get invalid expression: Unexpected token + in

but the syntax is supposed to be correct.

I tried like 20 other ways and everyone fails

Even if I put only column in there i get [Object object] instead of the actual column name


so, this doesn't work at all inside es6 template syntax. It only works if I put the templates inside <script> tags in the index.html file

export default{

  template: `
    <div :class="[c-${column}]">
       ....
       <router-link :to="/list/${item.name}"> test </router-link>
       ....
    </div>
  `,

   created(){

   }

 }

I tried

${column}   - undefined variable
${$column}  - undefined variable
`${column}` - unexpected identifier
  - invalid expression in vue

and other combinations and neither works inside the es6 template syntax.

so vuejs templates cannot be used with es6 modules and template syntax?



from Vuejs 2 impossible to interpolate attribute values

No comments:

Post a Comment