学无先后,达者为师

网站首页 编程语言 正文

判断element Ui 表格(el-table)中复选框中的选中状态

作者:qq_42208679 更新时间: 2022-01-30 编程语言

判断element Ui 表格(el-table)中复选框中的选中状态

组件

			 <el-table
			       :data="newTableData"
			         @select="selectionRow"
			         @select-all="selectionRowAll"
			         style="width: 100%">
			     <el-table-column
			             align="center"
			             type="selection"
			             width="50"
			     >
			     </el-table-column>
			     <el-table-column
			             align="center"
			             type="index"
			             width="50"
			             label="序号"
			     ></el-table-column>
			     <el-table-column
			             label="文件名称"
			             align="center"
			             prop="name">
			     </el-table-column>
			
			     <el-table-column
			         label="操作"
			         align="center"
			         prop="filepath">
			         <template slot-scope="scope">
			             <a
			                     style="color:#6abbf4"
			                     :href=""
			                     >下载</a>
			         </template>
			     </el-table-column>
			 </el-table>

方法

 // 表格复选框事件
            selectionRow(selection, row){
                let selected = selection.length && selection.indexOf(row) !== -1; //为true时选中,为 0 时(false)未选中
                if(selected){
                    this.deleteRowIdArray.push(row);
                }
            },

            //表格全选事件
            selectionRowAll(selection){
                this.deleteRowIdArray = selection;
            },

原文链接:https://blog.csdn.net/qq_42208679/article/details/111638368

栏目分类
最近更新