@zhangqingcq/vgce 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +35 -2
- package/dist/vgce.js +5035 -5293
- package/dist/vgce.umd.cjs +43 -143
- package/package.json +1 -1
- package/src/config/svg/stateless/index.ts +1 -17
- package/src/assets/svgs/bot-12.svg +0 -1
- package/src/assets/svgs/bot-3.svg +0 -1
- package/src/assets/svgs/bot-7.svg +0 -1
- package/src/assets/svgs/bot-9.svg +0 -94
- package/src/assets/svgs/car.svg +0 -1
- package/src/assets/svgs/hospital.svg +0 -1
- package/src/assets/svgs/traction-transformer.svg +0 -11
- package/src/config/svg/stateless/bot-12.ts +0 -22
- package/src/config/svg/stateless/bot-3.ts +0 -22
- package/src/config/svg/stateless/bot-7.ts +0 -22
- package/src/config/svg/stateless/bot-9.ts +0 -22
- package/src/config/svg/stateless/car.ts +0 -22
- package/src/config/svg/stateless/hospital.ts +0 -22
- package/src/config/svg/stateless/package.ts +0 -22
- package/src/config/svg/stateless/traction-transformer.ts +0 -28
package/README.md
CHANGED
@@ -34,16 +34,49 @@ Vector graphics configure editor. 矢量图组态编辑器。
|
|
34
34
|
</template>
|
35
35
|
```
|
36
36
|
|
37
|
-
5.custom toolbar
|
37
|
+
5. custom toolbar
|
38
38
|
* copy `src/config/` and change as you want
|
39
39
|
* put svg files into `src/asset/svgs` , then file name need to be same with config.name
|
40
40
|
* put custom parts file into `src/config/files`, then import in `src/config/index.ts` and export with `vueComp`
|
41
|
+
* PS: you have to install `vite-plugin-svg-icons` plugin to append your svgs to html dom.
|
41
42
|
```
|
42
43
|
<script setup lang="ts">
|
43
44
|
import {SvgEditor} from '@zhangqingcq/vgce'
|
44
45
|
import {config} from '@/config'
|
45
46
|
</script>
|
46
47
|
<template>
|
47
|
-
<SvgEditor
|
48
|
+
<SvgEditor :customToolbar="config"/>
|
48
49
|
</template>
|
49
50
|
```
|
51
|
+
|
52
|
+
5.1 how to use `vite-plugin-svg-icons`
|
53
|
+
* `npm i vite-plugin-svg-icons -D` or `pnpm add vite-plugin-svg-icons -D`
|
54
|
+
* change `vite.config.ts`
|
55
|
+
```
|
56
|
+
import { fileURLToPath, URL } from 'node:url'
|
57
|
+
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
58
|
+
|
59
|
+
export default defineConfig({
|
60
|
+
plugins: [
|
61
|
+
xxx,
|
62
|
+
createSvgIconsPlugin({
|
63
|
+
iconDirs: [fileURLToPath(new URL('./src/assets/svgs', import.meta.url))],
|
64
|
+
symbolId: 'svg-[name]',
|
65
|
+
svgoOptions: false,
|
66
|
+
customDomId: '__svg__icons__dom__'//your id, do not use this id!
|
67
|
+
})
|
68
|
+
],
|
69
|
+
xxx
|
70
|
+
})
|
71
|
+
```
|
72
|
+
* change `main.ts`
|
73
|
+
```
|
74
|
+
xxx
|
75
|
+
import 'virtual:svg-icons-register'
|
76
|
+
xxx
|
77
|
+
```
|
78
|
+
|
79
|
+
6. example
|
80
|
+
* download [VGCE](https://github.com/RickyHeaven/VGCE.git)
|
81
|
+
* `pnpm i` or `npm i`
|
82
|
+
* `pnpm dev` or `npm run dev`
|