vxe-table?實現(xiàn)?excel?選擇一個單元格拖拽自動復(fù)制新的單元格(示例代碼)
vxe-table 實現(xiàn) excel 選擇一個單元格,拖拽自動復(fù)制新的單元格
官網(wǎng):https://vxetable.cn

鼠標(biāo)按住右下角擴(kuò)展按鈕,當(dāng)選取一個單元格時,自動將當(dāng)前內(nèi)容填充到擴(kuò)展區(qū)域的所有單元格中
<template>
<div>
<vxe-grid v-bind="gridOptions"></vxe-grid>
</div>
</template>
<script>
export default {
data () {
const gridOptions = {
border: true,
height: 500,
showOverflow: true,
columnConfig: {
resizable: true
},
editConfig: {
mode: 'cell',
trigger: 'dblclick' // 雙擊單元格激活編輯狀態(tài)
},
mouseConfig: {
area: true,
extension: true // 是否開啟區(qū)域擴(kuò)展選取功能,開啟后可以通過鼠標(biāo)左鍵按住區(qū)域內(nèi)右下角擴(kuò)展按鈕,將區(qū)域橫向或縱向擴(kuò)大
},
areaConfig: {
extendByCopy: true // 是否啟用擴(kuò)展區(qū)域自動填充,當(dāng)選取一個單元格時,自動將當(dāng)前內(nèi)容填充到擴(kuò)展區(qū)域的所有單元格中(同時按住 ctrl 鍵可取消值自動識別數(shù)字功能)
},
keyboardConfig: {
arrowCursorLock: true,
isClip: true,
isArrow: true,
isShift: true,
isTab: true,
isEnter: true,
isEdit: true,
isDel: true,
isEsc: true,
isFNR: true // 是否開啟查找與替換
},
columns: [
{ type: 'seq', width: 60 },
{ field: 'a', title: 'A', editRender: { name: 'input' } },
{ field: 'b', title: 'B', editRender: { name: 'input' } },
{ field: 'c', title: 'C', editRender: { name: 'input' } },
{ field: 'd', title: 'D', editRender: { name: 'input' } },
{ field: 'e', title: 'E', editRender: { name: 'input' } },
{ field: 'f', title: 'F', editRender: { name: 'input' } },
{ field: 'g', title: 'G', editRender: { name: 'input' } },
{ field: 'h', title: 'H', editRender: { name: 'input' } }
],
data: [
{ id: 10001, a: 'Test1', b: 'Develop', c: 'Man', d: '23', e: '28', f: '', g: '', h: '' },
{ id: 10002, a: 'Test2', b: 'Test', c: 'Women', d: '23', e: '22', f: '', g: '', h: '' },
{ id: 10003, a: 'Test3', b: 'PM', c: 'Man', d: '23', e: '32', f: '', g: '', h: '' },
{ id: 10004, a: 'Test4', b: 'Designer', c: 'Women', d: '456', e: '24', f: '', g: '', h: '' },
{ id: 10005, a: 'Test5', b: 'Designer', c: 'Women', d: '23', e: '42', f: '', g: '', h: '' },
{ id: 10006, a: 'Test6', b: 'Designer', c: 'Man', d: '23', e: '38', f: '', g: '', h: '' },
{ id: 10007, a: 'Test7', b: 'Test', c: 'Women', d: '100', e: '24', f: '', g: '', h: '' },
{ id: 10008, a: 'Test8', b: 'PM', c: 'Man', d: '345', e: '34', f: '', g: '', h: '' },
{ id: 10009, a: 'Test9', b: 'Designer', c: 'Man', d: '67', e: '52', f: '', g: '', h: '' },
{ id: 10010, a: 'Test10', b: 'Test', c: 'Women', d: '23', e: '44', f: '', g: '', h: '' }
]
}
return {
gridOptions
}
}
}
</script>https://gitee.com/x-extends/vxe-table
到此這篇關(guān)于vxe-table 實現(xiàn) excel 選擇一個單元格,拖拽自動復(fù)制新的單元格的文章就介紹到這了,更多相關(guān)vxe-table 拖拽復(fù)制單元格內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Element-ui table中過濾條件變更表格內(nèi)容的方法
下面小編就為大家分享一篇Element-ui table中過濾條件變更表格內(nèi)容的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-03-03
vue element 多圖片組合預(yù)覽的實現(xiàn)
本文主要介紹了vue element多圖片預(yù)覽實現(xiàn)的相關(guān)資料,最近的項目中有圖片預(yù)覽的場景,本文就來介紹一下如何使用,感興趣的可以了解一下2023-08-08
vue3組合式api實現(xiàn)v-lazy圖片懶加載的方法實例
vue作為前端主流的3大框架之一,目前在國內(nèi)有著非常廣泛的應(yīng)用,下面這篇文章主要給大家介紹了關(guān)于vue3組合式api實現(xiàn)v-lazy圖片懶加載的相關(guān)資料,需要的朋友可以參考下2022-09-09

