Skip to content

Commit 1bdda66

Browse files
author
黄书伟
committed
1、table 组件添加事件on-custom-comp实现子组件与父组件通讯的目的
1 parent 554d0d0 commit 1bdda66

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

examples/doc/updateLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2017-11-8
2+
1、table 组件添加事件`on-custom-comp`实现子组件与父组件通讯的目的
13

24
2017-10-31
35
1、添加 [UMD](https://github.com/umdjs/umd) 版本,html 中可以直接通过 `<script>` 标签方式引入 #29 #22

libs/v-table/src/table.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
<span v-if="cellMergeContentType(rowIndex,col.field,item).isComponent">
9595
<component :rowData="item" :field="col.field ? col.field : ''"
9696
:index="rowIndex"
97-
:is="cellMerge(rowIndex,item,col.field).componentName"></component>
97+
:is="cellMerge(rowIndex,item,col.field).componentName" @on-custom-comp="customCompFunc"></component>
9898
</span>
9999
<span v-else v-html="cellMerge(rowIndex,item,col.field).content"></span>
100100
</div>
@@ -107,7 +107,7 @@
107107
>
108108
<span v-if="typeof col.componentName ==='string' && col.componentName.length > 0">
109109
<component :rowData="item" :field="col.field ? col.field : ''"
110-
:index="rowIndex" :is="col.componentName"></component>
110+
:index="rowIndex" :is="col.componentName" @on-custom-comp="customCompFunc"></component>
111111
</span>
112112
<span v-else-if="typeof col.formatter==='function'"
113113
v-html="col.formatter(item,rowIndex,pagingIndex,col.field)"></span>
@@ -238,7 +238,7 @@
238238
>
239239
<span v-if="cellMergeContentType(rowIndex,col.field,item).isComponent">
240240
<component :rowData="item" :field="col.field ? col.field : ''" :index="rowIndex"
241-
:is="cellMerge(rowIndex,item,col.field).componentName"></component>
241+
:is="cellMerge(rowIndex,item,col.field).componentName" @on-custom-comp="customCompFunc"></component>
242242
</span>
243243
<span v-else v-html="cellMerge(rowIndex,item,col.field).content">
244244
</span>
@@ -252,7 +252,7 @@
252252
>
253253
<span v-if="typeof col.componentName ==='string' && col.componentName.length > 0">
254254
<component :rowData="item" :field="col.field ? col.field : ''" :index="rowIndex"
255-
:is="col.componentName"></component>
255+
:is="col.componentName" @on-custom-comp="customCompFunc"></component>
256256
</span>
257257
<span v-else-if="typeof col.formatter==='function'"
258258
v-html="col.formatter(item,rowIndex,pagingIndex,col.field)">
@@ -508,7 +508,7 @@
508508
// 单个checkbox change event
509509
selectChange: Function,
510510
// checkbox-group change event
511-
selectGroupChange: Function
511+
selectGroupChange: Function,
512512
},
513513
computed: {
514514
@@ -603,6 +603,11 @@
603603
}
604604
},
605605
methods: {
606+
// custom columns component event
607+
customCompFunc(params){
608+
609+
this.$emit('on-custom-comp',params);
610+
},
606611
607612
setRowHoverColor(isMouseenter){
608613

packages/v-table/src/table.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
<span v-if="cellMergeContentType(rowIndex,col.field,item).isComponent">
9595
<component :rowData="item" :field="col.field ? col.field : ''"
9696
:index="rowIndex"
97-
:is="cellMerge(rowIndex,item,col.field).componentName"></component>
97+
:is="cellMerge(rowIndex,item,col.field).componentName" @on-custom-comp="customCompFunc"></component>
9898
</span>
9999
<span v-else v-html="cellMerge(rowIndex,item,col.field).content"></span>
100100
</div>
@@ -107,7 +107,7 @@
107107
>
108108
<span v-if="typeof col.componentName ==='string' && col.componentName.length > 0">
109109
<component :rowData="item" :field="col.field ? col.field : ''"
110-
:index="rowIndex" :is="col.componentName"></component>
110+
:index="rowIndex" :is="col.componentName" @on-custom-comp="customCompFunc"></component>
111111
</span>
112112
<span v-else-if="typeof col.formatter==='function'"
113113
v-html="col.formatter(item,rowIndex,pagingIndex,col.field)"></span>
@@ -238,7 +238,7 @@
238238
>
239239
<span v-if="cellMergeContentType(rowIndex,col.field,item).isComponent">
240240
<component :rowData="item" :field="col.field ? col.field : ''" :index="rowIndex"
241-
:is="cellMerge(rowIndex,item,col.field).componentName"></component>
241+
:is="cellMerge(rowIndex,item,col.field).componentName" @on-custom-comp="customCompFunc"></component>
242242
</span>
243243
<span v-else v-html="cellMerge(rowIndex,item,col.field).content">
244244
</span>
@@ -252,7 +252,7 @@
252252
>
253253
<span v-if="typeof col.componentName ==='string' && col.componentName.length > 0">
254254
<component :rowData="item" :field="col.field ? col.field : ''" :index="rowIndex"
255-
:is="col.componentName"></component>
255+
:is="col.componentName" @on-custom-comp="customCompFunc"></component>
256256
</span>
257257
<span v-else-if="typeof col.formatter==='function'"
258258
v-html="col.formatter(item,rowIndex,pagingIndex,col.field)">
@@ -508,7 +508,7 @@
508508
// 单个checkbox change event
509509
selectChange: Function,
510510
// checkbox-group change event
511-
selectGroupChange: Function
511+
selectGroupChange: Function,
512512
},
513513
computed: {
514514
@@ -603,6 +603,11 @@
603603
}
604604
},
605605
methods: {
606+
// custom columns component event
607+
customCompFunc(params){
608+
609+
this.$emit('on-custom-comp',params);
610+
},
606611
607612
setRowHoverColor(isMouseenter){
608613

umd/js/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)