@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 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 @customToolbar="config"/>
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`