diff --git a/src/assets/style/index.less b/src/assets/style/index.less new file mode 100644 index 0000000..e69de29 diff --git a/src/assets/svg/demo.svg b/src/assets/svg/demo.svg new file mode 100644 index 0000000..1dbe9d1 --- /dev/null +++ b/src/assets/svg/demo.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/components/index.js b/src/components/index.js new file mode 100644 index 0000000..865eff7 --- /dev/null +++ b/src/components/index.js @@ -0,0 +1,13 @@ +import svgIcon from './svg-icon.vue' + +const components = { + svgIcon, +} + +export default{ + install(Vue, opt){ + for(var i in components){ + Vue.component(i, components[i]) + } + } +} \ No newline at end of file diff --git a/src/components/svg-icon.vue b/src/components/svg-icon.vue new file mode 100644 index 0000000..1e4cf4f --- /dev/null +++ b/src/components/svg-icon.vue @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/src/config/svgBuilder.js b/src/config/svgBuilder.js new file mode 100644 index 0000000..0466c9e --- /dev/null +++ b/src/config/svgBuilder.js @@ -0,0 +1,65 @@ +import { readFileSync, readdirSync } from 'fs' + +let idPerfix = '' +const svgTitle = /', '') + svgRes.push(svg) + } + } + return svgRes +} + +export const svgBuilder = (path, perfix = 'icon') => { + if (path === '') return + idPerfix = perfix + const res = findSvgFile(path) + + return { + name: 'svg-transform', + transformIndexHtml(html) { + return html.replace( + '
', + ` + + + ` + ) + } + } +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index 6fbdc9b..709fd28 100644 --- a/src/main.js +++ b/src/main.js @@ -2,11 +2,13 @@ import { createApp } from 'vue' import App from './App.vue' import router from './router' import store from '@/store' +import regComponents from '@/components' console.log(import.meta.env,'--------------import------') var app=createApp(App) app.use(router) .use(store) + .use(regComponents) .mount('#app') app.config.globalProperties.foo='===foo====' // 全局配置属性 \ No newline at end of file diff --git a/src/views/Home.vue b/src/views/Home.vue index 8d86a58..768248a 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -3,11 +3,12 @@