update base-table

This commit is contained in:
lb
2022-08-08 10:54:23 +08:00
parent 65c4ce9d45
commit 333da8433e
3 changed files with 86 additions and 61 deletions

View File

@@ -0,0 +1,34 @@
/**
* @Author: lb
* @CreateDate: 2022.8.8
* @Modifier:
* @ModifiedDate:
* 表格里的文本组件
* 一般用途:展示查看详情入口
*/
export default {
name: 'TableTextComponent',
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
// for i18n inject:
defaultText: '查看详情'
}
},
methods: {
emitClick() {
this.$emit('emitData', {
action: this.injectData.actionName || 'view-detail-action',
data: this.injectData.emitFullData ? this.injectData : { id: this.injectData.id }
})
}
},
render: function (h) {
return h('span', null, [h('el-button', { props: { type: 'text' }, style: { paddingLeft: 0 } }, this.injectData.buttonContent || this.defaultText)])
}
}

View File

@@ -0,0 +1,45 @@
/**
* @Author: lb
* @CreateDate: 2022.8.8
* @Modifier:
* @ModifiedDate:
* 表格里的操作组件
* 一般用途:展示添加删除按钮
*/
export default {
name: 'TableOperations',
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
btnTypes: {
add: 'primary',
delete: 'danger',
detail: 'info'
// add more...
},
colors: {
// add more...
},
text: {
// for i18n inject:
add: '添加'
// add more...
}
}
},
methods: {
// 发射事件
},
render: function (h) {
let btns = []
for (const optionStr of this.injectData.head?.options) {
btns.push(h('el-button', { props: { type: this.btnTypes[optionStr] } }, optionStr))
}
return h('span', null, btns)
}
}