Vue dynamically binds the click method according to the index

<tr v-for="date in tableShowData">
  <td v-for="(key,i) in date" >{{ key }}</td>
</tr>

how to ignore binding

when binding a click method and other indexes according to the subscript iComple1.

Mar.05,2021

Under the

statement, this can be used, and it has been used this way all the time. I don't know why someone can't use it!

<td v-for="(key,i) in date"
  @click="i === 1 && func()">
  {{ key }}
</td>

to modify the answer upstairs, you need to set a function.

<td v-for="(key,i) in date"
  @click="() => i === 1 && func()">
  {{ key }}
</td>

in fact, all of them can be bound with click events. In particular, the click event distinguishes the situation of iSuppli events

.
<tr v-for="date in tableShowData">
    <td v-for="(key,i) in date" @click="clickHandler(i)">{{ key }}</td>
</tr>
...
clickHandler(i) {
    if (i !== 1) {
        return
    }
    // doSomething
}

you can do this

<td v-for="(key,i) in date" @click="i===1?func():''">{{ key }}</td>

Thank you God can use this method

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3884a-2c12b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3884a-2c12b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?