boldsinas101
boldsinas101

Reputation: 330

Able to enable row-click in Element UI for certain condition VueJS

I just want to ask how to enable the row click event in Element UI only for a certain condition. For example, the row should only be clicked if the status is 'Approved'

<el-table @row-click="view"> <!--the row can only be clicked if the status is 'Approved' -->
</el-table>

I don't have any idea about it. Or this code can be effective: :row-clicked

Upvotes: 0

Views: 2780

Answers (1)

U-Dev
U-Dev

Reputation: 1387

You can do something like, @row-click="condition ? view : undefined". if condition is true it will call the function else nothing will happen.

You can also use v-on="condition ? { 'row-click': view } : {}".

Upvotes: 1

Related Questions