Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue setting colspan

Tags:

vue.js

vuejs2

Following keeps throwing an error:

<th style="padding-right: 0px;" v-for="n in modelClustersList"  colspan="{{modelClustersList.length}}">

Its kind of wierd I can use the {{modelClustersList.length}} other places. Is colspan somehow special in Vue?

like image 899
Thomas Segato Avatar asked Oct 07 '17 15:10

Thomas Segato


Video Answer


1 Answers

use v-bind directive to manuplate html attribute,

v-bind:colspan="modelClustersList.length"

shorthand:

:colspan="modelClustersList.length"

Refer Vue docs: https://vuejs.org/v2/guide/syntax.html#Attributes

like image 185
Muthu Kumaran Avatar answered Oct 07 '22 01:10

Muthu Kumaran