# Angular中按需引用配置文件
/**
* HI_KITS 公共组件定义
* @class HIKITSCOMMONMODULES
* @description
* 将hi-kits 组件引入在项目中作为公共组件导入导出
*/
import { NgModule } from "@angular/core";
/*----------------- hikits库 ---------------------*/
import { HI_CONFIG } from 'hi-kits/_shared/config/config';
import { HiBoard } from "hi-kits/board";
import { HiButton } from "hi-kits/button";
import { HiGoods } from "hi-kits/goods";
import { HiDrawlottery } from 'hi-kits/drawlottery';
import { HiIcon } from "hi-kits/icon";
// ...
HI_CONFIG.case.install([
HiBoard,
HiButton,
HiGoods,
HiDrawlottery,
HiIcon,
// ...
])
@NgModule({})
export class HIKITSCOMMONMODULES {}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# React中按需引用Hi-kits
1.在项目中引入hi-kits
import { HI_CONFIG } from 'hi-kits/_shared/config/config';
import { HiBoard } from "hi-kits/board";
import { HiButton } from "hi-kits/button";
1
2
3
4
2
3
4
2.页面初始化时加载组件
HI_CONFIG.case.install([HiBoard, HiButton])
1
# Vue中按需引用Hi-kits
在Vue项目中的main.ts引入并注册,同React 中的使用方法相似
import { HI_CONFIG } from 'hi-kits/_shared/config/config';
import { HiBoard } from "hi-kits/board";
import { HiButton } from "hi-kits/button";
HI_CONFIG.case.install([HiBoard, HiButton])
1
2
3
4
5
6
2
3
4
5
6