73 lines
2.9 KiB
Vue
73 lines
2.9 KiB
Vue
![]() |
<template>
|
|||
|
<div>
|
|||
|
<Table tooltip-theme="light" ref="currentRowTable" :columns="columns3" :data="data1" :draggable="true" @on-drag-drop="onDragDrop"></Table>
|
|||
|
<Button @click="handleClearCurrentRow">Clear</Button>
|
|||
|
</div>
|
|||
|
</template>
|
|||
|
<script>
|
|||
|
export default {
|
|||
|
data () {
|
|||
|
return {
|
|||
|
columns3: [
|
|||
|
{
|
|||
|
type: 'index',
|
|||
|
width: 60,
|
|||
|
align: 'center',
|
|||
|
indexMethod (row) {
|
|||
|
return row._index;
|
|||
|
}
|
|||
|
},
|
|||
|
{
|
|||
|
title: 'Name',
|
|||
|
key: 'name'
|
|||
|
},
|
|||
|
{
|
|||
|
title: 'Age',
|
|||
|
key: 'age'
|
|||
|
},
|
|||
|
{
|
|||
|
title: 'Address',
|
|||
|
key: 'address',
|
|||
|
tooltip: true
|
|||
|
}
|
|||
|
],
|
|||
|
data1: [
|
|||
|
{
|
|||
|
name: 'John Brown',
|
|||
|
age: 18,
|
|||
|
address: '自定义渲染列,使用 Vue 的 Render 函数。传入两个参数,第一个是 h,第二个为对象,包含 row、column 和 index,分别指当前行数据,当前列数据,当前行索引,详见示例。自定义渲染列,使用 Vue 的 Render 函数。传入两个参数,第一个是 h,第二个为对象,包含 row、column 和 index,分别指当前行数据,当前列数据,当前行索引,详见示例。自定义渲染列,使用 Vue 的 Render 函数。传入两个参数,第一个是 h,第二个为对象,包含 row、column 和 index,分别指当前行数据,当前列数据,当前行索引,详见示例。',
|
|||
|
date: '2016-10-03'
|
|||
|
},
|
|||
|
{
|
|||
|
name: 'Jim Green',
|
|||
|
age: 24,
|
|||
|
address: 'London No. 1 Lake Park自定义渲染列,使用 Vue 的 Render 函',
|
|||
|
date: '2016-10-01'
|
|||
|
},
|
|||
|
{
|
|||
|
name: 'Joe Black',
|
|||
|
age: 30,
|
|||
|
address: 'Sydney No. 1 Lake Park',
|
|||
|
date: '2016-10-02'
|
|||
|
},
|
|||
|
{
|
|||
|
name: 'Jon Snow',
|
|||
|
age: 26,
|
|||
|
address: 'Ottawa No. 2 Lake Park',
|
|||
|
date: '2016-10-04'
|
|||
|
}
|
|||
|
]
|
|||
|
}
|
|||
|
},
|
|||
|
methods: {
|
|||
|
handleClearCurrentRow () {
|
|||
|
this.$refs.currentRowTable.clearCurrentRow();
|
|||
|
},
|
|||
|
onDragDrop(a,b){
|
|||
|
console.log(a,b);
|
|||
|
this.data1.splice(b,1,...this.data1.splice(a, 1 , this.data1[b]));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
</script>
|