forked from mt-fe-group/mt-yd-ui
update base-table
This commit is contained in:
34
src/components/base-table/components/detailComponent.js
Normal file
34
src/components/base-table/components/detailComponent.js
Normal 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)])
|
||||
}
|
||||
}
|
||||
45
src/components/base-table/components/operationComponent.js
Normal file
45
src/components/base-table/components/operationComponent.js
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user