0

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

1 Answer 1

1

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 } : {}".

Sign up to request clarification or add additional context in comments.

1 Comment

for example if the condition is came from data, something like this <el-table :data="dataList" @row-click="dataList.status === 'Approved' ? view : undefined"> that condition would work?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.