VUE頁(yè)面中通過(guò)雙擊實(shí)現(xiàn)復(fù)制表格中內(nèi)容的示例代碼
上篇文章給大家介紹了Vue實(shí)現(xiàn)點(diǎn)擊按鈕復(fù)制文本內(nèi)容的例子,喜歡的朋友可以點(diǎn)擊查看,今天給大家分享VUE頁(yè)面中通過(guò)雙擊實(shí)現(xiàn)復(fù)制表格中內(nèi)容,通過(guò)示例代碼講解的非常詳細(xì),需要的朋友參考下吧!
VUE頁(yè)面中通過(guò)雙擊實(shí)現(xiàn)復(fù)制表格中內(nèi)容頁(yè)面預(yù)覽:
vue中代碼實(shí)現(xiàn):
<template> <el-table :data='tableData' border style='width: 100%'> <el-table-column prop='date' label='日期' width='180'> </el-table-column> <el-table-column prop='name' label='姓名' width='180'> <template slot-scope='scope'> <span @dblclick='copyVale(scope.row.name)'> {{scope.row.name}} </span> </template> </el-table-column> <el-table-column prop='address' label='地址'> </el-table-column> </el-table></template><script> export default { data() { return { tableData: [{ date: ’2016-05-03’, name: ’張三’, address: ’上海市普陀區(qū)金沙江路 1511 弄’ }, { date: ’2016-05-02’, name: ’李四’, address: ’上海市普陀區(qū)金沙江路 1512 弄’ }, { date: ’2016-05-04’, name: ’王五’, address: ’上海市普陀區(qū)金沙江路 1513 弄’ }] } }, methods: { copyVale(v) { this.$message({message: ’復(fù)制成功,內(nèi)容為:‘’ + v + ’’’, type:’success’}) var inputEle = document.createElement('input'); inputEle.style.display = 'none' inputEle.value = v inputEle.select() document.execCommand('Copy') inputEle.remove() } } }</script>
總結(jié)
到此這篇關(guān)于VUE頁(yè)面中通過(guò)雙擊實(shí)現(xiàn)復(fù)制表格中內(nèi)容的文章就介紹到這了,更多相關(guān)vue 雙擊復(fù)制表格內(nèi)容內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. jsp+mysql實(shí)現(xiàn)網(wǎng)頁(yè)的分頁(yè)查詢2. Docker 部署 Prometheus的安裝詳細(xì)教程3. JavaScript Tab菜單實(shí)現(xiàn)過(guò)程解析4. ThinkPHP5 通過(guò)ajax插入圖片并實(shí)時(shí)顯示(完整代碼)5. Python使用oslo.vmware管理ESXI虛擬機(jī)的示例參考6. IntelliJ IDEA設(shè)置條件斷點(diǎn)的方法步驟7. Ajax引擎 ajax請(qǐng)求步驟詳細(xì)代碼8. Android實(shí)現(xiàn)圖片自動(dòng)切換功能(實(shí)例代碼詳解)9. javascript設(shè)計(jì)模式 ? 建造者模式原理與應(yīng)用實(shí)例分析10. 存儲(chǔ)于xml中需要的HTML轉(zhuǎn)義代碼
