forked from DevCloudFE/vue-devui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoolbar.tsx
28 lines (27 loc) · 883 Bytes
/
toolbar.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { defineComponent } from 'vue';
import ToolbarItem from './toolbar-item';
import { useToolbar } from '../composables/use-editor-md-toolbar';
import './toolbar.scss';
export default defineComponent({
name: 'DMdToolbar',
setup() {
const { toolbars, toolbarConfig, customToolbars } = useToolbar();
const tempToolbars = { ...toolbars, ...customToolbars?.value };
return () => (
<div class="md-toolbar-container">
{toolbarConfig.value.map((item, index) =>
Array.isArray(item) ? (
<>
{item.map((key, idx) => (
<ToolbarItem config={tempToolbars[key]} key={`${index}-${idx}`} />
))}
<span class="md-toolbar-span"></span>
</>
) : (
<ToolbarItem config={tempToolbars[item]} key={index} />
)
)}
</div>
);
},
});