tab优化,表格优化

This commit is contained in:
Gary Fu
2024-01-01 18:34:58 +08:00
parent cd12a30764
commit 702a1bb8fb
9 changed files with 98 additions and 14 deletions

View File

@@ -10,6 +10,10 @@
* @property {string} slot 自定义插槽
* @property [ButtonProps] buttons 自定义按钮
* @property {Object} attrs 其他属性
* @property {string} link 链接地址
* @property {Object} linkAttrs 链接配置
* @method click 点击事件
* @method formatter 格式化
*/
/**
* 配置信息
@@ -22,6 +26,9 @@ const props = defineProps({
type: Object,
required: true
},
/**
* @type {'large'|'small'|'default'}
*/
buttonSize: {
type: String,
default: 'small'
@@ -37,13 +44,24 @@ const props = defineProps({
:property="column.property"
:width="column.width"
v-bind="column.attrs"
:formatter="column.formatter"
>
<template
v-if="column.slot"
v-if="column.slot||column.link||column.click"
#default="scope"
>
<el-link
v-if="column.link||column.click"
:href="column.link"
type="primary"
v-bind="column.linkAttrs"
@click="column.click&&column.click(scope.row, scope)"
>
{{ scope.row[column.property] }}
</el-link>
<slot
v-bind="scope"
:column-conf="column"
name="default"
/>
</template>

View File

@@ -67,7 +67,10 @@ const props = defineProps({
}
}
})
/**
*
* @type {ComputedRef<[CommonTableColumn]>}
*/
const calcColumns = computed(() => {
let _columns = props.columns
if (props.buttons.length || props.buttonsSlot) {
@@ -102,8 +105,10 @@ const calcColumns = computed(() => {
#default="scope"
>
<slot
v-if="column.slot"
:scope="scope"
:item="scope.row"
:column-conf="scope.columnConf"
:name="column.slot"
/>
</template>

View File

@@ -25,6 +25,16 @@ const menuName = computed(() => {
const menuInfo = computed(() => {
return props.tabItem.path === '/' ? { icon: 'HomeFilled' } : useMenuInfo(props.tabItem)
})
const menuIcon = computed(() => {
if (menuInfo.value && menuInfo.value.icon) {
return menuInfo.value.icon
}
if (props.tabItem.meta && props.tabItem.meta.icon) {
return props.tabItem.meta.icon
}
return null
})
</script>
<template>
@@ -35,8 +45,8 @@ const menuInfo = computed(() => {
<el-dropdown trigger="contextmenu">
<span class="custom-tabs-label">
<common-icon
v-if="tabsViewStore.isShowTabIcon && menuInfo && menuInfo.icon"
:icon="menuInfo.icon"
v-if="tabsViewStore.isShowTabIcon && menuIcon"
:icon="menuIcon"
/>
<span>{{ menuName }}</span>
</span>