0
点赞
收藏
分享

微信扫一扫

Element-UI 表格动态添加响应校验

前程有光 2022-02-17 阅读 99
vueelementui

方法添加表格数据

绑定prop(只做记录日后详解 copy就完了)

<el-form :model="form" :rules="rules" ref="ruleForm">
	<el-table :data="form.tableData" border style="width: 100%">
		<el-table-column prop="price" label="价格" align="center">
			<template slot-scope="scope">
				<el-form-item :prop="'tableData.' + scope.$index +'.price'" :rules="rules.price">
					<el-input-number v-model="scope.row.price" :precision="2" :min="0.01"></el-input-number>
				</el-form-item>
			</template>
		</el-table-column>
		<el-table-column prop="count" label="数量" align="center">
			<template slot-scope="scope">
				<el-form-item :prop="'tableData.' + scope.$index + '.count'" :rules="rules.count">
					<el-input-number v-model="scope.row.count" :min="0"></el-input-number>
				</el-form-item>
			</template>
		</el-table-column>
	</el-table>
</el-form>
举报

相关推荐

0 条评论