我来更新啦!最近写了一个二次封装的多选弹窗小组件,记录一下嘻嘻!
二次封装element,首先要对element的相应组件有深入的了解:)
好啦,词穷了,代码可直接食用。
代码如下:
<template>
<div class="publish-dialog">
<el-dialog
title="发布范围"
:visible.sync="showSizeDialog"
>
<div class="dialog-title">
<div
v-for="(item, index) in tabList"
:key="`active_${index}`"
class="tab-menu"
><span
:class="activeTab=== item.label ? 'active' : ''"
@click="handleActive(item)"
>{
{
item.label }}</span></div>
<el-checkbox
v-model="checkedTotal"
@change="handleCheckTotal"
>全部</el-checkbox>
<span class="total-count">已选{
{
totalCount }}家</span>
</div>
<div class="tab-content">
<div
v-for="(ele, key) in checkData"
:key="`checked_${key}`"
class="check-box"
>
<!-- <div class="check-box"> -->
<div class="all-check">
<el-checkbox
v-model="ele.checkAll"
:indeterminate="ele.isIndeterminate"
@change="handleCheckAll(ele)"
>{
{
ele.checkI }}</el-checkbox>
</div>
<div class="check-list">
<el-checkbox-group
v-model="ele.value"
@change="handleChecked(ele)"