Questions about element.ui tables

ask whether the element.ui table can filter columns and choose which columns to display or not to display.

Mar.28,2021

For questions like this, please read element-ui read the table component of the official website. The answer can generally be found

clipboard.png


this function has been done, but based on the depth of the business, it has been written into a global mixin, inconvenient paste code. The general idea is as follows:

because considering that the filtering function of ElTable is to filter data, it is not used. Instead, a drop-down header is customized with render-header . The header is a button and a drop-down menu is clicked.

determine the display and hiding of a column according to the click of the menu. An array is used to maintain the display and hiding of all the columns of the table, and each column of the table is controlled by v-if.

Menu