Skip to content

Commit

Permalink
fix(iconfont): 更改引入 iconfont 方式
Browse files Browse the repository at this point in the history
  • Loading branch information
白唯 committed Oct 13, 2020
1 parent 7affdf8 commit e11f13c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## [0.1.7](https://github.com/ibwei/vue3-base/compare/v0.1.8...v0.1.7) (2020-09-29)


### Bug Fixes

* **less:** 更新 less 版本,兼容 antdv ([1f9c248](https://github.com/ibwei/vue3-base/commit/1f9c2488fa35fc4e8fe52229db48ca1f53813fb1))
* **readme.md:** 修改项目说明文档 ([0065d42](https://github.com/ibwei/vue3-base/commit/0065d420b18ee3ddc13396b1436faee090806a16))
* **types:** 更改部分 type 说明 ([89b0a19](https://github.com/ibwei/vue3-base/commit/89b0a193629576f49146d968460658c66e8e1895))
* **vue3:** 更新到 vue3 正式版并修复错误 ([074b83a](https://github.com/ibwei/vue3-base/commit/074b83a8db7ed1f68d6fb4faf0f04302743a02c5))


### Features

* **i18n:** 主要增加了国际化方案 ([7affdf8](https://github.com/ibwei/vue3-base/commit/7affdf821bf934e4fc364ab89bb9731475987141))
* **vuex:** 添加了 vuex 打印日志服务 ([badae42](https://github.com/ibwei/vue3-base/commit/badae42d9561fc155a45b152f496e2ca955a5532))
* **测试:** 添加测试例子,完善vuex的类型 ([b833160](https://github.com/ibwei/vue3-base/commit/b833160194808b4fd04aa0dbca1223449c7d1e88))


### Performance Improvements

* **插件:** 插件更新为自动化加载 ([e0d39c4](https://github.com/ibwei/vue3-base/commit/e0d39c43c81c21d50c250a9d833d9d012ff7a55b))



## [0.1.6](https://github.com/ibwei/vue3-base/compare/v0.1.8...v0.1.6) (2020-09-17)


Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
- [x] 建立应用数据状态管理
- [x] 编写更加建议读取的方法,并完善 type
- [x] 支持多个模块,以及自动装载模块
- [ ] 支持持久化 (vue3 暂不支持)
- [x] 支持持久化

#### UI 库

Expand All @@ -112,6 +112,7 @@
#### 插件与常用工具函数

- [x] 引用常用工具函数
- [x] 常用 hook

#### 配置

Expand All @@ -130,7 +131,7 @@

#### CI/CD

- [ ] 配置自动构建/持续集成配置文件(与部署相关,需结合到具体项目部署情况)
- [x] 配置自动构建/持续集成配置文件(与部署相关,需结合到具体项目部署情况)

#### 文档

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue3-base-type",
"version": "0.1.7",
"version": "0.1.8",
"description": "一个使用vue3+typescript 搭建的项目基础架构类型声明库",
"author": {
"name": "ibwei",
Expand Down
14 changes: 12 additions & 2 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import { kebabCase } from 'lodash'
import { createApp } from 'vue'
import { createFromIconfontCN } from '@ant-design/icons-vue'
import { StaticConfig } from '@/config/app'
// iconfont的使用姿势: 2x.antdv.com/components/icon-cn/#components-icon-demo-use-iconfont.cn
const IconFont: any = createFromIconfontCN({
scriptUrl: StaticConfig.IconfontURL
})

/**
* @description 自动将 ./src/components/global 下的组件注册成为全局组件
* @param {vue} app 当前应用实例
* @returns {void} void
*/
export function registeGlobalComponent(app: ReturnType<typeof createApp>): void {
const files = require.context('./global', true, /\.vue$/)
files.keys().forEach((key) => {
const files = require.context('./global', true, /\.(vue|ts)$/)
files.keys().forEach(key => {
const config = files(key)
console.log(key)
const name = kebabCase(key.replace(/^\.\//, '').replace(/\.\w+$/, ''))
app.component(name, config.default || config)
})

// 全局注册 iconfont
app.component('IconFont', IconFont)
}
5 changes: 4 additions & 1 deletion src/config/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ import { message } from 'ant-design-vue'
const AppConfig = {
$message: message
}
export { AppConfig }
const StaticConfig = {
IconfontURL: '//at.alicdn.com/t/font_2092412_rr3rb5vksd8.js'
}
export { AppConfig, StaticConfig }

0 comments on commit e11f13c

Please sign in to comment.