0.0.3 • Published 3 years ago

@aning/edge-ui v0.0.3

Weekly downloads
121
License
ISC
Repository
-
Last release
3 years ago

Edge-UI

边缘UI组件库

使用

下载

git clone [本仓库地址]

项目中使用了子仓库,需要手动初始化子仓库

git submodule init

clone 子仓库

git submodule update

安装

先在本项目根目录使用 npm link,将本项目链接到全局的 node_modules 文件架;

npm link

在所需的项目根目录中运行

npm link edge-ui

安装 babel-plugin-import

因为工程代码不会编译 node_modules 内的代码,所以需要在引入后进行编译。这里使用 babel-plugin-import

npm install babel-plugin-import --save-dev

配置项目的 babel.config.js

module.exports = {
  plugins: [
    ['import', {
      'libraryName': 'edge-ui',
      'libraryDirectory': 'exports',
      'camel2DashComponentName': false
    }, 'edge-ui']
  ]
};

使用

按需引入的方式使用

import { Button } from 'edge-ui' 

开发

  • npm run add <name> 添加组件
  • npm run add -b <name> 添加基础组件

添加组件

使用命令自动添加组件

npm run add <组件名>

添加基础组件,使用 -b 参数

npm run add -b <组件名>

生成 exports 文件

为了方便按需引入,统一在 exports 目录中导出组件,配合 babel-plugin-import 从这里读取文件。 使用命令自动生成 exports 目录

npm run export

通过 -c--clear 清除 exports 目录

npm run export -c

目录

|--- build 没啥
+-- docs  文档,暂无
+-- examples 例子,暂无
+-- exports 导出
+-- libs 依赖第三方组件库,放在这里方便修改
+-- scripts 脚本
+-- site 组件库展示网站
+-- src 源代码
+-- test 测试