代码示例如下:
<!-- -->
<template>
<a-button type="primary" style="padding-left: 10px; padding-right: 10px" @click="handleAddRow">
<template #icon><plus-outlined /></template>新增
</a-button>
<a-form :model="dataSource" ref="AddModalForm" :labelCol="{ style: { width: '10px' } }">
<a-table :dataSource="dataSource" :columns="columns" size="small" rowKey="id">
<template #bodyCell="{ column, index, record }">
<template v-if="column.dataIndex === 'nation'">
<a-form-item label=" " name="nation" :rules="[{ required: true, message: '请输入名称,长度小于20字符', validator: () => customCheck(index, 'nation') }]">