修复:修复引入Arco Design Vue打包报错的问题(引入图标组件打包就会报错,改为引入对应svg图标)

This commit is contained in:
2022-08-06 22:32:22 +08:00
parent 60433c483a
commit 917977a11d
4 changed files with 30 additions and 19 deletions

View File

@@ -3,8 +3,6 @@
"version": "1.0.0", "version": "1.0.0",
"description": "Charles's personal knowledge repositories.", "description": "Charles's personal knowledge repositories.",
"main": "index.js", "main": "index.js",
"author": "Charles7c",
"license": "MIT",
"scripts": { "scripts": {
"dev": "node collect-article-data.mjs && vitepress dev repos", "dev": "node collect-article-data.mjs && vitepress dev repos",
"build": "node collect-article-data.mjs && vitepress build repos", "build": "node collect-article-data.mjs && vitepress build repos",
@@ -17,10 +15,28 @@
"@arco-design/web-vue": "^2.34.1", "@arco-design/web-vue": "^2.34.1",
"blueimp-md5": "^2.19.0", "blueimp-md5": "^2.19.0",
"dayjs": "^1.11.4", "dayjs": "^1.11.4",
"element-plus": "^2.2.9",
"fast-glob": "^3.2.11", "fast-glob": "^3.2.11",
"gitalk": "^1.7.2", "gitalk": "^1.7.2",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
"vue": "^3.2.37" "vue": "^3.2.37"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Charles7c/charles7c.github.io.git"
},
"keywords": [
"blog",
"charles7c",
"vitepress-blog",
"vitepress",
"vuepress",
"vite",
"vue"
],
"author": "Charles7c",
"license": "MIT",
"homepage": "https://github.com/Charles7c/charles7c.github.io#readme",
"bugs": {
"url": "https://github.com/Charles7c/charles7c.github.io/issues"
} }
} }

View File

@@ -10,10 +10,13 @@
:label="formatDate(article.date)" :label="formatDate(article.date)"
> >
<template #dot> <template #dot>
<IconBug :style="{color: '#f53f3f'}" v-if="article.categories.includes('Bug万象集')" /> <svg v-if="article.categories.includes('Bug万象集')" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" class="arco-icon arco-icon-bug" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter" data-v-8ed9eb22="" style="color: #f53f3f;"><path d="M24 42c-6.075 0-11-4.925-11-11V18h22v13c0 6.075-4.925 11-11 11Zm0 0V23m11 4h8M5 27h8M7 14a4 4 0 0 0 4 4h26a4 4 0 0 0 4-4m0 28v-.5a6.5 6.5 0 0 0-6.5-6.5M7 42v-.5a6.5 6.5 0 0 1 6.5-6.5M17 14a7 7 0 1 1 14 0"></path></svg>
<IconBulb :style="{color: '#ff7d00'}" v-else-if="article.categories.includes('杂碎逆袭史')" />
<IconCode v-else-if="article.categories.includes('方案春秋志')" /> <svg v-else-if="article.categories.includes('杂碎逆袭史')" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" class="arco-icon arco-icon-bulb" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter" data-v-8ed9eb22="" style="color: #ff7d00;"><path d="M17 42h14m6-24c0 2.823-.9 5.437-2.43 7.568-1.539 2.147-3.185 4.32-3.77 6.897l-.623 2.756A1 1 0 0 1 29.2 36H18.8a1 1 0 0 1-.976-.779l-.624-2.756c-.584-2.576-2.23-4.75-3.77-6.897A12.94 12.94 0 0 1 11 18c0-7.18 5.82-13 13-13s13 5.82 13 13Z"></path></svg>
<IconBookmark :style="{color: '#00b42a'}" v-else />
<svg v-else-if="article.categories.includes('方案春秋志')" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" class="arco-icon arco-icon-code" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter" data-v-8ed9eb22=""><path d="M16.734 12.686 5.42 24l11.314 11.314m14.521-22.628L42.57 24 31.255 35.314M27.2 6.28l-6.251 35.453"></path></svg>
<svg v-else viewBox="0 0 48 48" fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg" class="arco-icon arco-icon-bookmark" stroke-width="4" stroke-linecap="butt" stroke-linejoin="miter" data-v-8ed9eb22="" style="color: #00b42a;"><path d="M16 16h16M16 24h8"></path><path d="M24 41H8V6h32v17"></path><path d="M30 29h11v13l-5.5-3.5L30 42V29Z"></path></svg>
</template> </template>
<a :href="article.path" class="title" target="_blank">{{ article.title }}</a> <a :href="article.path" class="title" target="_blank">{{ article.title }}</a>
</a-timeline-item> </a-timeline-item>
@@ -23,9 +26,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { IconBug, IconBulb, IconCode, IconBookmark } from '@arco-design/web-vue/es/icon'
import articleData from '../../../../article-data.json' import articleData from '../../../../article-data.json'
import { formatDate } from '../utils.ts' import { formatDate } from '../utils.ts'
import { IconBug, IconBulb, IconCode, IconBookmark } from '@arco-design/web-vue/es/icon'
const articles = computed(() => articleData.sort((a, b) => a.date.localeCompare(b.date))) const articles = computed(() => articleData.sort((a, b) => a.date.localeCompare(b.date)))
</script> </script>

View File

@@ -85,7 +85,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { useData } from 'vitepress' import { useData } from 'vitepress'
import { IconTags } from '@arco-design/web-vue/es/icon'
import articleData from '../../../../article-data.json' import articleData from '../../../../article-data.json'
import { formatDate } from '../utils.ts' import { formatDate } from '../utils.ts'
import '../styles/article-meta-data.css' import '../styles/article-meta-data.css'

View File

@@ -1,25 +1,18 @@
import DefaultTheme from 'vitepress/theme' import DefaultTheme from 'vitepress/theme'
import MyLayout from "./MyLayout.vue" import MyLayout from "./MyLayout.vue"
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import ArcoVue from '@arco-design/web-vue' import ArcoVue from '@arco-design/web-vue'
import '@arco-design/web-vue/dist/arco.css' import '@arco-design/web-vue/dist/arco.css'
import './styles/vars.css'
import './styles/custom.css'
import ArticleMetadata from './components/ArticleMetadata.vue' import ArticleMetadata from './components/ArticleMetadata.vue'
import Tag from './components/Tag.vue' import Tag from './components/Tag.vue'
import Archive from './components/Archive.vue' import Archive from './components/Archive.vue'
import './styles/vars.css'
import './styles/custom.css'
export default { export default {
...DefaultTheme, ...DefaultTheme,
Layout: MyLayout, Layout: MyLayout,
enhanceApp({ app }) { enhanceApp({ app }) {
// 屏蔽警告信息 // 全局注册Arco Design Vue
app.config.warnHandler = () => null
// 全局注册ElementPlus
app.use(ElementPlus)
// 全局注册ArcoDesignVue
app.use(ArcoVue) app.use(ArcoVue)
app.component('ArticleMetadata', ArticleMetadata) app.component('ArticleMetadata', ArticleMetadata)