el-table中加入el-input框和el-input-number框,实现el-table的可编辑功能

本文介绍了如何在Element UI中使用el-table实现动态输入小数位数和设置上下限,并通过el-input-number和el-input组件配合template展示。方法涉及表格列的配置及 handleChange事件的处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

实现效果:

 实现方法:

<el-table class="drow_table" :data="tableData" style="width: 100%" row-key="id">
					<el-table-column type="selection" width="45px"></el-table-column>
					<el-table-column type="index" label="序号" width="50px"></el-table-column>
					<el-table-column label="小数位数" property="digit" width="140px">
						<template slot-scope="scope">
							<el-input-number v-model="scope.row.digit" @change="handleChange" :min="0" :max="5" label="描述文字"></el-input-number>
						</template>
					</el-table-column>
					<el-table-column label="上限" property="maxVal">
						<template slot-scope="scope">
							<el-input v-model="scope.row.maxVal"></el-input>
						</template>
					</el-table-column>
					<el-table-column label="下限" property="minVal">
						<template slot-scope="scope">
							<el-input v-model="scope.row.minVal"></el-input>
						</template>
					</el-table-column>
				</el-table>
methods:{
//  InputNumber 计数器
		handleChange(value) {
			console.log(value)
		},}

在需要加入el-input和el-input-number的列使用template即可。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值