# captain-ui

> 有赞vue wap业务组件库

Latest version **2.0.5** (published 2019-11-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install captain-ui
pnpm add captain-ui
yarn add captain-ui
bun add captain-ui
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2019-11-20 |
| First published | 2017-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 3.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | youzanfe |
| Maintainers | chenjiahan, codpoe, cookfront, fanyue, gentean, jerryni, jojo, pangxie1991, qianyongjun, tsxuehu, w91, zgrong |
| Keywords | youzan, vue, component |

## Links

- npm: https://www.npmjs.com/package/captain-ui
- Repository: git@gitlab.qima-inc.com:fe/vue-captain
- npm.io page: https://npm.io/package/captain-ui

## Dependencies (6)

- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [zan-ajax](https://npm.io/package/zan-ajax.md) >= 2.0.0
- [@youzan/utils](https://npm.io/package/@youzan/utils.md) ^2.3.7
- [@youzan/yz-aes](https://npm.io/package/@youzan/yz-aes.md) ^1.0.0
- [@vant/waterfall](https://npm.io/package/@vant/waterfall.md) ^1.0.0
- [@youzan/zan-jsbridge](https://npm.io/package/@youzan/zan-jsbridge.md) >= 0.5.0

## Recent versions

- 2.0.5 (latest) — 2019-11-20
- 2.0.0-beta.0 (beta) — 2019-07-23
- 2.0.4 — 2019-10-10
- 2.0.3 — 2019-10-08
- 2.0.2 — 2019-09-27
- 2.0.1 — 2019-09-23
- 1.0.32 — 2019-09-23
- 2.0.0 — 2019-08-14
- 1.0.31 — 2019-08-08
- 1.0.30 — 2019-07-22
- 1.0.29 — 2019-07-12
- 1.0.28 — 2019-06-21
- 1.0.27 — 2019-06-21
- 1.0.27-beta.2 — 2019-06-05
- 1.0.27-beta.1 — 2019-05-28
- … 408 more at https://npm.io/package/captain-ui/versions

## README

# Captain UI

## 版本区分

- master 分支基于 Vant 2 开发，版本号为 2.x
- 1.x    分支基于 Vant 1 开发，版本号为 1.x

## 安装

```shell
npm i -S captain-ui
```

## 使用

### 使用 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) (推荐)
```js
// .babelrc or babel-loader option
{
 "plugins": [
   ["import", { "libraryName": "captain-ui", "style": true }]
 ]
}
```
接着你可以直接引入 captain-ui 组件，等价于下方的按需引入组件

```js
// 模块化地引入 js 和 css, 通过 babel-plugin-import 插件解析
import { Pay } from 'captain-ui';
```

### 按需引入

#### js引入

每个组件都有自己对应的npm包，可以直接单独引入对应的包
```js
import { Pay } from 'captain-pay';
```
#### css引入
css 文件引入需要 [postcss-easy-import](https://github.com/TrySound/postcss-easy-import) 类似插件解析引入的css文件路径
```css
@import 'captain-pay';
// 没有插件的情况下，可以用以下方式直接引入
// @import 'captain-pay/lib/index.css';
```

## 运行示例demo

### 安装项目依赖

```shell
yarn install
ynpm install -g felint #代码校验
felint hooks #添加校验钩子
```

### 增加 localhost host解析
```
localhost 127.0.0.1
```

### 运行demo

```sehll
make dev
```
在浏览器中打开 [http://localhost:3003/](http://localhost:3003/) 即可

## 开发新组件
以创建组件 OrderPay 为例

### 增加文档导航配置
在 `docs/doc.config.js` 中增加对应的文档配置

### 文档编写
在 `docs/examples-docs` 目录下增加对应组件的文档，默认会直接引入 `index.md` 文档进行编译
与index.md同级目录下的 `config.js` 定义mock的请求数据，格式如下：

```javascript
module.exports = [{
  // 发起请求的链接
  url: '/v2/pay/UnifiedCashier/getQrcode.json',
  // 发起请求的请求方式
  method: 'POST',
  // 请求的返回数据内容
  response: {
   code: 0,
   msg: '处理成功',
   data: {
    content: 'aHR0cHM6Ly93d3cuaGFvMTIzLmNvbS8=',
    imageFormat: 'png',
    codeFormat: 'QR_CODE',
    encoding: 'BASE64',
    width: 300,
    height: 300
   }
  }
}, {
  url: '/v2/pay/UnifiedCashier/payStatus.json',
  method: 'POST',
  response: {
   code: 0,
   msg: '处理成功',
   data: {
    status: 'success'
   }
  }
}];
```

# 如何更新文档网站

1. 本地构建

```bash
npm run deploy
```

2. 登录 qa 机器更新代码
没有 qa 机器权限的话，可以在 ops 上申请，应用名为 fe-lab

```bash
i qabb-fe-doc0
cd /data/project/captain-ui/
sudo git pull
```

---
_Source: https://npm.io/package/captain-ui · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
