npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

captain-ui

v2.0.5

Published

有赞vue wap业务组件库

Downloads

453

Readme

Captain UI

版本区分

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

安装

npm i -S captain-ui

使用

使用 babel-plugin-import (推荐)

// .babelrc or babel-loader option
{
 "plugins": [
   ["import", { "libraryName": "captain-ui", "style": true }]
 ]
}

接着你可以直接引入 captain-ui 组件,等价于下方的按需引入组件

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

按需引入

js引入

每个组件都有自己对应的npm包,可以直接单独引入对应的包

import { Pay } from 'captain-pay';

css引入

css 文件引入需要 postcss-easy-import 类似插件解析引入的css文件路径

@import 'captain-pay';
// 没有插件的情况下,可以用以下方式直接引入
// @import 'captain-pay/lib/index.css';

运行示例demo

安装项目依赖

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

增加 localhost host解析

localhost 127.0.0.1

运行demo

make dev

在浏览器中打开 http://localhost:3003/ 即可

开发新组件

以创建组件 OrderPay 为例

增加文档导航配置

docs/doc.config.js 中增加对应的文档配置

文档编写

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

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. 本地构建
npm run deploy
  1. 登录 qa 机器更新代码 没有 qa 机器权限的话,可以在 ops 上申请,应用名为 fe-lab
i qabb-fe-doc0
cd /data/project/captain-ui/
sudo git pull