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. asp中response.write("中文")或者js中文亂碼問(wèn)題2. asp取整數(shù)mod 有小數(shù)的就自動(dòng)加13. CSS3中Transition屬性詳解以及示例分享4. 詳解盒子端CSS動(dòng)畫性能提升5. 利用CSS制作3D動(dòng)畫6. 怎樣才能用js生成xmldom對(duì)象,并且在firefox中也實(shí)現(xiàn)xml數(shù)據(jù)島?7. CSS hack用法案例詳解8. 怎樣打開XML文件?xml文件如何打開?9. css代碼優(yōu)化的12個(gè)技巧10. XML入門的常見問(wèn)題(二)
