Skip to content

Commit b7221b8

Browse files
author
283591387@qq.com
committed
完善移动端vol-table示例
1 parent d15e630 commit b7221b8

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

vol.uniapp/pages/table/table2/table2.vue

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
<vol-alert>
44
<view>表格支持水平或列表显示、事件绑定、数据源自动转换、行格式化、自动分页,见table2.vue页面</view>
55
</vol-alert>
6-
<vol-table :url="tableUrl" @rowClick="rowClick" :defaultLoadPage="load" @loadBefore="loadBefore"
7-
:height="tableHeight" :titleField="titleField" :index="rowIndex" @loadAfter="loadAfter" ref="table"
8-
:direction="direction" @formatter="formatter" :columns.sync="columns" :textInline="textInline">
6+
<vol-table :url="tableUrl" @rowButtons="rowButtons" @rowButtonClick="rowButtonClick" @rowClick="rowClick"
7+
:defaultLoadPage="load" @loadBefore="loadBefore" :height="tableHeight" :titleField="titleField"
8+
:index="rowIndex" @loadAfter="loadAfter" ref="table" :direction="direction" @formatter="formatter"
9+
:columns.sync="columns" :textInline="textInline">
910
</vol-table>
1011
</view>
1112
</template>
@@ -29,7 +30,7 @@
2930
},
3031
{
3132
field: 'ExpertName',
32-
title: '名称'
33+
title: '名称'
3334
},
3435
{
3536
field: 'UserName',
@@ -91,7 +92,34 @@
9192
},
9293
loadBefore(params, callback) {
9394
callback(true);
94-
}
95+
},
96+
rowButtons(index, row, callback) { //列表显示的按钮
97+
//if(row.xx=='')
98+
//自定义按钮,仅onInited中设置:this.direction = "list"后生效
99+
let buttons = [{
100+
text: "测试",
101+
icon: "plus",
102+
type: "primary",
103+
shape: "circle",
104+
//disabled: true
105+
}, {
106+
text: "删除",
107+
icon: "trash",
108+
type: "error",
109+
plain: true,
110+
shape: "circle",
111+
//shape:"",//square、circle
112+
//disabled: false
113+
}];
114+
callback(buttons);
115+
},
116+
rowButtonClick(btn, index, row) { //列表显示的按钮点击事件
117+
if (btn.text == '删除') {
118+
this.$toast('删除按钮')
119+
} else {
120+
this.$toast('测试按钮')
121+
}
122+
},
95123
}
96124
}
97125
</script>

0 commit comments

Comments
 (0)