element表格資料複製
阿新 • • 發佈:2020-12-27
技術標籤:element ui
效果圖如下
程式碼如下
<el-table-column label="appId" prop="id">
<template slot-scope="scope">
<el-popover placement="top" width="100" popper-class="copy-popper" trigger="hover">
<el-link type ="text" @click="copy(scope.row)">點選複製</el-link>
<el-button type="text" slot="reference">{{ scope.row.id }}</el-button>
</el-popover>
</template>
</el-table-column>
copy(row) {
this.$copyText(row.id).then(() => {
this.$message.success('複製成功')
}).catch(() => {
this.$message.warning('複製失敗')
})
}