这段代码表格有行点击事件,行中有三个a标签,分别有点击事件,目标是点击行中的a标签时,不触发行的点击事件。 <a-table ref="table" size="middle" bordered rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading" :customRow="rowClick" @change="handleTableChange"> <span slot="action" slot-scope="text, record"> <a @click="handlePreview(record)">查看</a> <a-divider type="vertical" v-show="uploader"/> <a-popconfirm v-show="uploader" title="确定删除吗?" @confirm="(e) => handleDelete(record.id)"> <a>删除</a> </a-popconfirm> <a-divider type="vertical"/> <a @click="handleDonwload(record)">下载</a> </span> </a-table>
实现方式:
<span slot="action" slot-scope="text, record"> <a @click.stop="handlePreview(record)">查看</a> <a-divider type="vertical" v-show="uploader"/> <a-popconfirm v-show="uploader" title="确定删除吗?" @confirm="(e) => handleDelete(record.id)"> <a @click.stop>删除</a> </a-popconfirm> <a-divider type="vertical"/> <a @click.stop="handleDonwload(record)">下载</a> </span>
特别是 popconfirm 控件,需要控件在 <a @click.stop>删除</a> 中