222
schangxiang@126.com
2025-04-30 9bec4dcae002f36aa23231da11cb03a156b40110
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { defineComponent } from 'vue'
import styles from './ToolBar.module.scss'
import BaseConfigProvider from '@/components/BaseConfigProvider/BaseConfigProvider'
import { _t } from '@/libs/Language/Language'
 
export default defineComponent({
  name: 'ToolBar',
  components: {
    BaseConfigProvider,
  },
  setup() {
    const namespace = import.meta.env.VITE_APP_NAMESPACE
 
    const toolBar = [
      {
        code: 'undo',
        name: _t('撤销'),
        icon: 'undo.svg',
      },
      {
        code: 'redo',
        name: _t('恢复'),
        icon: 'redo.svg',
      },
      {
        code: 'enlarge',
        name: _t('放大'),
        icon: 'enlarge.svg',
      },
      {
        code: 'reduce',
        name: _t('缩小'),
        icon: 'reduce.svg',
      },
      {
        code: 'format',
        name: _t('美化'),
        icon: 'format1.svg',
      },
      {
        code: 'download',
        name: _t('下载'),
        icon: 'download.svg',
      },
      {
        code: 'import',
        name: _t('导入'),
        icon: 'import.svg',
      },
      {
        code: 'export',
        name: _t('导出'),
        icon: 'export.png',
      },
    ]
    return () => {
      return (
        <ul class={styles.toolBarContent}>
          {toolBar.map((item: any) => {
            const imgUrl = new URL(
              `../../../../assets/images/${item.icon}`,
              import.meta.url
            ).href
            return (
              <el-config-provider namespace={namespace}>
                <el-tooltip
                  class="box-item"
                  effect="dark"
                  content={item.name}
                  placement="right"
                >
                  <li
                    class={styles.toolBarItem}
                    key={item.code}
                    // @ts-ignore
                    code={item.code}
                  >
                    <img
                      src={imgUrl}
                      width={20}
                      height={20}
                      // @ts-ignore
                      code={item.code}
                    />
                  </li>
                </el-tooltip>
              </el-config-provider>
            )
          })}
        </ul>
      )
    }
  },
})