项目作者: cqkqinfo

项目描述 :
基于 Remax 全平台 UI 库
高级语言: TypeScript
项目地址: git://github.com/cqkqinfo/ui.git
创建时间: 2021-09-18T07:00:21Z
项目社区:https://github.com/cqkqinfo/ui

开源协议:MIT License

下载


凯桥 UI

@kqinfo/ui"">NPM version Test coverage @kqinfo/ui"">npm download

使用

  1. $ yarn add @kqinfo/ui

按需加载

安装babel-plugin-import插件

  1. $ yarn add babel-plugin-import -D

修改babel.config.js文件

  1. // babel.config.js
  2. module.exports = {
  3. plugins: [
  4. + [
  5. + 'import',
  6. + {
  7. + libraryDirectory: 'es',
  8. + libraryName: '@kqinfo/ui'
  9. + },
  10. + '@kqinfo/ui'
  11. + ]
  12. ]
  13. };

定制主题

修改remax.config.js文件

  1. module.exports = {
  2. ...
  3. - plugins: [less()],
  4. + plugins: [
  5. + less({
  6. + lessOptions: {
  7. + modifyVars: { '@brand-primary': '#2780d9', '@brand-attract': '#ff9d46' },
  8. + javascriptEnabled: true
  9. + }
  10. + })
  11. + ]
  12. ...
  13. };

修改app.tsx文件

  1. +import { ConfigProvider } from '@kqinfo/ui';
  2. const App = (props) => {
  3. - return props.children;
  4. + return <ConfigProvider brandAttract={'#ff9d46'} brandPrimary={'#2780d9'}>{props.children}</ConfigProvider>;
  5. };

使用源安装

在项目根目录添加.npmrc文件

  1. canvas_binary_host_mirror=https://npm.taobao.org/mirrors/canvas/
  2. sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
  3. phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
  4. electron_mirror=https://npm.taobao.org/mirrors/electron/
  5. chromedriver_cdnurl=https://npm.taobao.org/mirrors/chromedriver/
  6. sentrycli_cdnurl=https://cdn.npm.taobao.org/dist/sentry-cli
  7. cypress_download_mirror=https://npm.taobao.org/mirrors/cypress/

yarn安装的话添加.yarnrc文件

  1. canvas_binary_host_mirror: https://npm.taobao.org/mirrors/canvas
  2. registry: https://registry.npm.taobao.org
  3. ENTRYCLI_CDNURL: https://cdn.npm.taobao.org/dist/sentry-cli
  4. sentrycli_cdnurl: https://cdn.npm.taobao.org/dist/sentry-cli

开发

安装依赖

  1. $ yarn

启动服务

  1. $ yarn start

本地调试

启动调试

  1. $ yarn dev

本地连接

  1. $ yarn link

本地项目调试

  1. $ yarn link @kqinfo/ui

编写测试

开发注意项

  • fork到自己名下,再提merge request
  • 样式不要嵌套
  • 样式用less-modules
  • 表单组件暴露valueonChange
  • 不要用图片当icon
  • 尽量暴露节点的class,缩写用cls,比如暴露子项类名就用itemCls
  • 例子尽量写多点

钉钉交流群