Skip to content

Commit c50aa47

Browse files
committed
Update table method
1 parent dd2e1c3 commit c50aa47

File tree

6 files changed

+29
-20
lines changed

6 files changed

+29
-20
lines changed

dev/App.vue

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import Egrid from '../src/index'
2828
import Data from './data'
2929
import Btn from './cell-btn.vue'
3030
import Editor from './cell-editor.vue'
31+
console.log(Egrid)
3132
export default {
3233
name: 'app',
3334
data () {

docs/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,8 @@ allowfullscreen="allowfullscreen" frameborder="0">
330330

331331
`clearSelection` `toggleRowSelection` `setCurrentRow`
332332

333+
`toggleRowExpansion` `clearSort` `clearFilter`
334+
333335
!> 直接代理一层原 `Element Table` 的方法。可参考[文档](http://element.eleme.io/#/zh-CN/component/table#table-methods)
334336

335337

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "egrid",
33
"description": "element-ui table packaging component",
4-
"version": "1.0.4",
4+
"version": "1.0.5",
55
"author": "芊野 <[email protected]>",
66
"private": false,
77
"repository": {

src/main.vue

+16
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,22 @@ export default {
129129
}
130130
},
131131
132+
methods: {
133+
getColBind (col) {
134+
const bind = Object.assign({}, col)
135+
delete bind.component
136+
delete bind.listeners
137+
delete bind.propsHandler
138+
return bind
139+
},
140+
141+
getCptBind ({ row, column }, col) {
142+
const props = { row, col, column }
143+
const handler = col.propsHandler
144+
return handler && handler(props) || props
145+
}
146+
},
147+
132148
components: {
133149
[ElTable.name]: ElTable,
134150
[ElTableColumn.name]: ElTableColumn

src/methods.js

+8-18
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,20 @@
11
export default {
22
methods: {
3-
getColBind (col) {
4-
const bind = Object.assign({}, col)
5-
delete bind.component
6-
delete bind.listeners
7-
delete bind.propsHandler
8-
return bind
9-
},
10-
11-
getCptBind ({ row, column }, col) {
12-
const props = { row, col, column }
13-
const handler = col.propsHandler
14-
return handler && handler(props) || props
15-
},
16-
173
trigger (method, ...args) {
184
const { $refs: { grid } } = this
195
if (grid && grid[method]) {
206
grid[method](...args)
217
}
228
},
239

24-
clearSelection (...args) {
25-
this.trigger('clearSelection', ...args)
26-
},
27-
2810
toggleRowSelection (...args) {
2911
this.trigger('toggleRowSelection', ...args)
3012
},
3113

14+
toggleRowExpansion (...args) {
15+
this.trigger('toggleRowExpansion', ...args)
16+
},
17+
3218
setCurrentRow (...args) {
3319
this.trigger('setCurrentRow', ...args)
3420
},
@@ -39,6 +25,10 @@ export default {
3925

4026
clearFilter () {
4127
this.trigger('clearFilter')
28+
},
29+
30+
clearSelection (...args) {
31+
this.trigger('clearSelection', ...args)
4232
}
4333
}
4434
}

0 commit comments

Comments
 (0)