Please teach the table component of element ui how to hide or display multiple specified buttons.

is like this. By default, a page table needs to write the contents of the first three lines, and it cannot be edited. Of course, the button also needs to be hidden

.

clipboard.png

clipboard.png

before referring to the big shots of the code Baidu, using a ternary expression to hide only a
may be because js is not too familiar with it, very embarrassing. I can"t think of an idea for a long time.
you need to hide or replace the buttons after id 1, 2, 3 with the string"-". )
Please tell me how to write thank you guys.
then ask to learn some JS resource books or video tutorials, I feel that js is the key point or js is too lame.


since the first three items are fixed, wouldn't it be better to judge whether the button is displayed or hidden by indexing scope.$index .


ide/list.html-sharp%E7%94%A8-v-for-%E6%8A%8A%E4%B8%80%E4%B8%AA%E6%95%B0%E7%BB%84%E5%AF%B9%E5%BA%94%E4%B8%BA%E4%B8%80%E7%BB%84%E5%85%83%E7%B4%A0" rel=" nofollow noreferrer "> chain Then describe in the v-for block, We have full access to the parent scope properties. V-for also supports an optional second parameter that is the index of the current item.
VFF = "(item, index)" VFI = "index < 3"


clipboard.png

well, why didn't you think of it? just a v-if (scope.$index < 3? False: true) will be done.


if I read it correctly
you want to hide the first three buttons
, then VFI for = "(item, index) in data" data is your data
VFI = "index < 3" so that you can hide
the same id to judge the same VIFF = "scope.row.id < = 3"
put which button you want to hide.
hide all the buttons.

Menu