vue中用Element-ui封装表单(form)和表格(table)组件动态渲染数据展示

<el-radio-group v-if=“item.type===‘RadioButton’” v-model=“searchData[item.prop]” @change=“item.change && item.change(searchData[item.prop])”>

{{ra.label}}

{{ch.label}}

<el-button :type=“item.type” :size=“item.size || size” @click=‘item.handle()’>{{item.label}}

table.vue

<el-button v-for=‘(item , index) in tableHandles’ :size=“item.size || size” :type=“item.type” :icon=‘item.icon’ @click=“item.handle()” :key=“index”>{{item.label}}

<el-table

:data=‘tableData’

:size=‘size’

:border =‘isBorder’

@select=‘select’

@select-all=‘selectAll’

v-loading=‘loading’

header-row-class-name=“header_row_style”

:defaultSelections=‘defaultSelections’

ref=“cesTable”>

<el-table-column v-for=“item in tableCols”

:key=“item.id”

:prop=“item.prop”

:label=“item.label”

:width=“item.width”

:align=“item.align”

show-overflow-tooltip

:render-header=“item.require?renderHeader:null”

<el-button v-for=“(btn , index) in item.btnList”

:disabled=“btn.isDisabled && btn.isDisabled(scope.row)”

:type=“btn.type”

:size=“btn.size || size”

:icon=“btn.icon”

:key=“index”

@click=“btn.handle(scope.row)”>{{btn.label}}

<el-input v-if=“item.type===‘Input’” v-model=“scope.row[item.prop]” :size=“size”

:disabled=“btn.isDisabled && btn.isDisabled(scope.row)”

@focus=“item.focus && item.focus(scope.row)”>

<el-select v-if=“item.type===‘Select’” v-model=“scope.row[item.prop]” :size=“size” :props=“item.props”

:disabled=“btn.isDisabled && btn.isDisabled(scope.row)”

@change=‘item.change && item.change(scope.row)’>

<el-radio-group v-if=“item.type===‘Radio’” v-model=“scope.row[item.prop]”

:disabled=“btn.isDisabled && btn.isDisabled(scope.row)”

@change=‘item.change && item.change(scope.row)’>

{{ra.label}}

<el-checkbox-group v-if=“item.type===‘Checkbox’” v-model=“scope.row[item.prop]”

:disabled=“btn.isDisabled && btn.isDisabled(scope.row)”

@change=‘item.change && item.change(scope.row)’>

{{ra.label}}

<el-rate v-if=“item.type===‘Rate’” v-model=“scope.row[item.prop]”

:disabled=“btn.isDisabled && btn.isDisabled(scope.row)”

@change=‘item.change && item.change(scope.row)’>

<el-switch v-if=“item.type===‘Switch’” v-model=“scope.row[item.prop]”

:disabled=“btn.isDisabled && btn.isDisabled(scope.row)”

@change=‘item.change && item.change(scope.row)’>

<img v-if=“item.type===‘Image’” :src=“scope.row[item.prop]” @click=“item.handle && item.handle(scope.row)”/>

<el-slider v-if=“item.type===‘Slider’” v-model=“scope.row[item.prop]”

:disabled=“btn.isDisabled && btn.isDisabled(scope.row)”

@change=‘item.change && item.change(scope.row)’>

<span v-if=“!item.type”

:style=“item.itemStyle && item.itemStyle(scope.row)”

:class=“item.itemClass && item.item.itemClass(scope.row)”>{{(item.formatter && item.formatter(scope.row)) || scope.row[item.prop]}}

<el-pagination style=‘display: flex;justify-content: center;height: 100%;align-items: center;’

@current-change=“handleCurrentChange”

@size-change=“handleSizeChange”

layout=“total,sizes ,prev, pager, next,jumper”

:page-size=“pagination.pageSize”

:current-page=“pagination.pageNum”

:total=“pagination.total”

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值