提交 2b6adbfb 编写于 作者: RedPig97's avatar RedPig97

update: 更新

上级 56e71961
...@@ -27,7 +27,7 @@ const emit = defineEmits<toolbarEmit>(); ...@@ -27,7 +27,7 @@ const emit = defineEmits<toolbarEmit>();
const items: Ref<IParam[]> = ref(props.actionModel || []); const items: Ref<IParam[]> = ref(props.actionModel || []);
console.log(items); console.log(items);
const getItemClass = (item: IParam) => { const getItemClass = (item: IParam) => {
return item.class; return item?.class;
}; };
const getItemIcon = (item: IParam) => { const getItemIcon = (item: IParam) => {
if (item.getPSSysImage) { if (item.getPSSysImage) {
...@@ -44,7 +44,7 @@ const itemClick = (item: IParam) => { ...@@ -44,7 +44,7 @@ const itemClick = (item: IParam) => {
</script> </script>
<template> <template>
<div class="toolbar"> <div class="toolbar">
<a-space :class="`toolbar-${mode}`"> <a-space v-if="Object.is(mode,'button')" class="toolbar-button">
<template v-for="(item, index) in items" :key="index"> <template v-for="(item, index) in items" :key="index">
<a-tooltip <a-tooltip
v-if="Object.is(item.itemType, 'DEUIACTION')" v-if="Object.is(item.itemType, 'DEUIACTION')"
...@@ -55,13 +55,12 @@ const itemClick = (item: IParam) => { ...@@ -55,13 +55,12 @@ const itemClick = (item: IParam) => {
v-show="true" v-show="true"
:class="['toolbar-item', getItemClass(item)]" :class="['toolbar-item', getItemClass(item)]"
:disabled="item.disabled" :disabled="item.disabled"
:type="Object.is(mode,'link') ? 'link': 'primary'" type="primary"
@click="itemClick(item)" @click="itemClick(item)"
> >
<a-icon v-show="item.showIcon" :type="getItemIcon(item)" /> <!-- <a-icon v-show="item.showIcon" :type="getItemIcon(item)" /> -->
\{{ item.showCaption ? item.caption : "" }} {{ item.showCaption ? item.caption : "" }}
</a-button> </a-button>
<div v-if="item.addSeparator" class="separator"></div>
</a-tooltip> </a-tooltip>
<a-dropdown v-else-if="Object.is(item.itemType, 'items')"> <a-dropdown v-else-if="Object.is(item.itemType, 'items')">
<a-menu slot="overlay" @click="itemClick"> <a-menu slot="overlay" @click="itemClick">
...@@ -77,17 +76,32 @@ const itemClick = (item: IParam) => { ...@@ -77,17 +76,32 @@ const itemClick = (item: IParam) => {
type="primary" type="primary"
@click="itemClick(childItem)" @click="itemClick(childItem)"
> >
<a-icon <!-- <a-icon
v-show="childItem.showIcon" v-show="childItem.showIcon"
:type="getItemIcon(childItem)" :type="getItemIcon(childItem)"
/> /> -->
\{{ childItem.showCaption ? childItem.caption : "" }} {{ childItem.showCaption ? childItem.caption : "" }}
</a-menu-item> </a-menu-item>
</a-tooltip> </a-tooltip>
</a-menu> </a-menu>
</a-dropdown> </a-dropdown>
</template> </template>
</a-space> </a-space>
<a-space v-else class="toolbar-link">
<template v-for="(item, index) in items" :key="index">
<a-button
v-show="item.visabled"
:class="['toolbar-item', getItemClass(item)]"
:disabled="item.disabled"
type="link"
@click="itemClick(item)"
>
<!-- <a-icon v-show="item.showIcon" :type="getItemIcon(item)" /> -->
{{ item.showCaption ? item.caption : "" }}
</a-button>
<div v-if="item.separator" class="separator"></div>
</template>
</a-space>
</div> </div>
</template> </template>
...@@ -95,6 +109,7 @@ const itemClick = (item: IParam) => { ...@@ -95,6 +109,7 @@ const itemClick = (item: IParam) => {
.toolbar { .toolbar {
.toolbar-link { .toolbar-link {
gap: 0 !important; gap: 0 !important;
display: inline;
.ant-space-item { .ant-space-item {
position: relative; position: relative;
.separator { .separator {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册