Browse Source

替换掉ant-design的字体图标

pipipi-pikachu 5 years ago
parent
commit
f923af91b4
6 changed files with 567 additions and 585 deletions
  1. 537 576
      package-lock.json
  2. 0 1
      package.json
  3. 2 0
      public/index.html
  4. 0 7
      src/components/IconFont.ts
  5. 27 0
      src/components/IconFont.vue
  6. 1 1
      src/main.ts

File diff suppressed because it is too large
+ 537 - 576
package-lock.json


+ 0 - 1
package.json

@@ -9,7 +9,6 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
-    "@ant-design/icons-vue": "^5.1.9",
     "animate.css": "^4.1.1",
     "ant-design-vue": "^2.0.0-rc.3",
     "chart.js": "^2.9.4",

+ 2 - 0
public/index.html

@@ -14,5 +14,7 @@
     </noscript>
     <div id="app"></div>
     <!-- built files will be auto injected -->
+
+    <script src="//at.alicdn.com/t/font_2317509_skpetzgttwg.js"></script>
   </body>
 </html>

+ 0 - 7
src/components/IconFont.ts

@@ -1,7 +0,0 @@
-/* eslint-disable */
-
-import { createFromIconfontCN } from '@ant-design/icons-vue'
-
-export default createFromIconfontCN({
-  scriptUrl: '//at.alicdn.com/t/font_2317509_skpetzgttwg.js',
-}) as any

+ 27 - 0
src/components/IconFont.vue

@@ -0,0 +1,27 @@
+<template>
+  <svg class="icon-font" aria-hidden="true">
+    <use :xlink:href="`#${type}`"></use>
+  </svg>
+</template>
+
+<script lang="ts">
+export default {
+  name: 'icon-font',
+  props: {
+    type: {
+      type: String,
+      required: true,
+    },
+  },
+}
+</script>
+
+<style lang="scss" scoped>
+.icon-font {
+  width: 1em;
+  height: 1em;
+  vertical-align: -0.15em;
+  fill: currentColor;
+  overflow: hidden;
+}
+</style>

+ 1 - 1
src/main.ts

@@ -11,7 +11,7 @@ import 'animate.css'
 import Contextmenu from './plugins/contextmenu'
 import ClickOutside from './plugins/clickOutside'
 
-import IconFont from '@/components/IconFont'
+import IconFont from '@/components/IconFont.vue'
 import FileInput from '@/components/FileInput.vue'
 import SvgWrapper from '@/components/SvgWrapper.vue'
 import CheckboxButton from '@/components/CheckboxButton.vue'