Commit 21510632 by luyt

add:补全GlTableButton组件文档与示例

1 parent dedd00ce
...@@ -44,6 +44,10 @@ ...@@ -44,6 +44,10 @@
title: 'GLSearch', title: 'GLSearch',
link: '/components/GLSearch' link: '/components/GLSearch'
}, },
{
title: 'GLTableButton',
link: '/components/GLTableButton'
},
] ]
}] }]
......
...@@ -392,6 +392,7 @@ export default { ...@@ -392,6 +392,7 @@ export default {
type: 'datePicker', type: 'datePicker',
isClear: true, isClear: true,
pickerOptions: 'beforeRangePickerOptions', pickerOptions: 'beforeRangePickerOptions',
//label 显示隐藏
showLabel:false, showLabel:false,
}, },
{ {
......
<!-- <content> -->
<GLTable ref="liveRoomRef" :tableParams="tableParams" :tableData="tableData">
<span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope">
<!-- test 更多操作 -->
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</span>
</GLTable>
<el-button type="warning" @click="toggleShow(1)">显示代码</el-button>
```js {mixin:true}
{
data() {
return {
demo1: true,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '最近开播',
prop: 'time',
width: '180',
formatter: cellValue => {
return cellValue.startTime + '-' + cellValue.endTime
},
columnattrs: {},
columnlisteners: {}
},
{
label: '直播间',
prop: 'name',
line: 1,
width: 90
// children:[
// {
// label: '直播间名称1',
// prop: 'name1',
// line: 1,
// },
// {
// label: '直播间名称2',
// prop: 'name2',
// line: 1,
// },
// ]
},
{
label: '房间号',
prop: 'roomId'
},
{
label: '主播',
prop: 'anchorName',
line: 1
},
{
label: '图片',
prop: 'shareImgUrl',
line: 1,
addHtml: 'shareImgUrl'
},
]
},
tableData: [
{
name: '王小虎王小虎王小虎王',
liveStatus3: '132',
liveStatus4: '789',
name1: '123',
name2: '123'
},
{
name: '王小虎王小虎王小虎王王小虎王小虎王小虎王王小虎王小虎王小虎王王小虎王小虎王小虎王小虎王小虎王王小虎王小虎王小虎王',
liveStatus3: '132',
liveStatus4: '789',
name1: '123',
name2: '123'
},
{
name: '王小虎',
name1: '123',
name2: '123'
},
{
name: '王小虎王小虎王小虎王',
liveStatus3: '132',
liveStatus4: '789',
name1: '123',
name2: '123'
},
],
// 测试表格更多操作项
buttonList: [
{
type: 'el-button',
name: row => {
return '打开'
},
condition: row => {
return false
},
attrs: {
type: 'text'
},
listeners: {
click: this.conditionFn
}
},
{
type: 'el-button',
name: row => {
return '新增1'
},
condition: row => {
return true
},
attrs: {
type: 'text'
},
listeners: {
click: this.conditionFn
}
},
{
type: 'el-button',
name: row => {
return '新增2'
},
condition: row => {
return true
},
attrs: {
type: 'text'
},
listeners: {
click: this.conditionFn
}
},
{
// 类型
type: 'el-button',
// 名字 //自定义内容 可以是html结构
name: row => {
return '新增3'
},
// 条件判断
condition: row => {
return true
},
// 属性
attrs: {
type: 'text'
},
//click事件
listeners: {
click: this.conditionFn
}
},
{
type: 'el-button',
//自定义内容
name: row => {
return '<div>自定义<i class="el-icon-edit"></i></div>'
},
condition: row => {
return true
},
attrs: {
type: 'text'
},
listeners: {
click: this.conditionFn
}
}
]
}
},
methods:{
btnClick(){
alert('点击')
},
toggleShow(num){
// console.log(123)
this['demo' + num] = !this['demo' + num]
}
}
}
```
# 用来作为 markdown 代码的示例部分
<div v-if="demo1">
```html
<template>
<GLTable ref="liveRoomRef" :tableParams="tableParams" :tableData="tableData">
<span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope">
<!-- test 更多操作 -->
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</span>
</GLTable>
</template>
<script>
export default {
data() {
return {
// 测试表格更多操作项
buttonList: [
{
type: 'el-button',
name: row => {
return '打开'
},
condition: row => {
return false
},
attrs: {
type: 'text'
},
listeners: {
click: this.conditionFn
}
},
{
type: 'el-button',
name: row => {
return '新增1'
},
condition: row => {
return true
},
attrs: {
type: 'text'
},
listeners: {
click: this.conditionFn
}
},
{
type: 'el-button',
name: row => {
return '新增2'
},
condition: row => {
return true
},
attrs: {
type: 'text'
},
listeners: {
click: this.conditionFn
}
},
{
// 类型
type: 'el-button',
// 名字 //自定义内容 可以是html结构
name: row => {
return '新增3'
},
// 条件判断
condition: row => {
return true
},
// 属性
attrs: {
type: 'text'
},
//click事件
listeners: {
click: this.conditionFn
}
},
{
type: 'el-button',
//自定义内容
name: row => {
return '<div>自定义<i class="el-icon-edit"></i></div>'
},
condition: row => {
return true
},
attrs: {
type: 'text'
},
listeners: {
click: this.conditionFn
}
}
]
}
},
methods: {
//test table 更多 单行数据 ,单行的配置项
conditionFn(row,config) {
console.log('row: ', row,config)
}
}
}
</script>
```
</div>
<!-- </content> -->
\ No newline at end of file \ No newline at end of file
...@@ -2,14 +2,17 @@ ...@@ -2,14 +2,17 @@
export default { export default {
name: 'GLTableButton', name: 'GLTableButton',
props: { props: {
// 按钮条件数组
buttonList: { buttonList: {
type: Array, type: Array,
default: () => [] default: () => []
}, },
// table中每一行的数据
buttonItem: { buttonItem: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
}, },
// 默认一行按钮的个数
buttonNum: { buttonNum: {
type: Number, type: Number,
default: 3 default: 3
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!