-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
11,295 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,148 +1,51 @@ | ||
|
||
# @antmjs/vantui | ||
|
||
> 一套适用于Taro3的vantui组件库 | ||
### 简介 | ||
|
||
## 为什么需要 | ||
一套基于 Taro 框架开发的多端 UI 组件库 | ||
|
||
基于VantUI改造的Taro组件库 | ||
组件库99%基于有赞团队的[vant-weapp](https://github.com/youzan/vant-weapp)改造而来 | ||
|
||
## 安装 | ||
#### 说明 | ||
|
||
```bash | ||
yarn add @antmjs/vantui | ||
``` | ||
|
||
## 使用 | ||
|
||
src/style/index.less | ||
|
||
```css | ||
@import 'node_modules/@antmjs/vantui/dist/style/index'; | ||
``` | ||
- 为什么要做这个组件库?我们认为有赞团队的组件库经过了多年的实践积累,以及经过我们的实际体验之后认为确实是一款优秀的组件库,但可惜的是他们只提供了Vue版本和微信小程序版本,但我们的技术架构选用的是京东的Taro,所以就开始思考如何能把有赞微信小程序的版本迁移到Taro上面来,最终我们实现了@antmjs/vantui。 | ||
- 为什么是99%?迁移的步骤其实不难,第一步100%同步样式,第二步通过Taro convert转译之后再重构js部分,但因为有赞微信小程序的版本只完全基于微信小程序实现的,所以在兼容支付宝小程序、H5的时候还是存在不能100%兼容的情况,具体的个别差异点下面有提供。 | ||
|
||
```js | ||
import { Button } from '@antmjs/vantui' | ||
``` | ||
#### 优势 | ||
|
||
yarn && npx husky install | ||
- TS类型安全 | ||
- 目前支持微信小程序、支付宝小程序、H5。其他端逐渐更新中... | ||
|
||
npx lerna bootstrap | ||
#### 安装 | ||
|
||
cd packages/vantui -> npx rollup -c ./rollup.watch.config.js -w | ||
|
||
cd packages/vantui-demo -> yarn watch:weapp | ||
yarn add @antmjs/vantui | ||
|
||
注意事项: | ||
#### 差异点 | ||
- 组件属性均用驼峰代替 | ||
- slot改为传递通过属性传递ReactNode | ||
|
||
customClass -> className | ||
#### 使用 | ||
|
||
追加calssName和style和others | ||
```app.less | ||
@import '@antmjs/vantui/dist/style/index.less'; | ||
|
||
``` | ||
className={ | ||
utils.bem('nav-bar', { | ||
fixed, | ||
}) + | ||
' custom-class ' + | ||
(border ? 'van-hairline--bottom' : '') + | ||
` ${className}` | ||
page, | ||
body { | ||
font-size: 28px; | ||
} | ||
style={utils.style([ | ||
computed.barStyle({ | ||
zIndex, | ||
statusBarHeight, | ||
safeAreaInsetTop, | ||
}) + | ||
'; ' + | ||
customStyle, | ||
style, | ||
])} | ||
{...others} | ||
``` | ||
|
||
slot代码的转换是通过传递render函数 | ||
|
||
$emit 相当于子组件触发props的函数 | ||
|
||
https://github.com/youzan/vant-weapp/commits/dev | ||
|
||
本仓库是从1.8.4的版本迁移出来,所以1.8.4以后的commit需要修复 | ||
|
||
getRect getAllRect的第一个参数传null就行 | ||
|
||
|
||
|
||
|
||
织夏: | ||
Toast | ||
Style | ||
|
||
Divider | ||
Empty | ||
NoticeBar | ||
Collapse | ||
Circle | ||
|
||
Checkbox | ||
Radio | ||
Switch | ||
Uploader | ||
|
||
|
||
空镜 | ||
Image[完成] | ||
Layout[完成] | ||
|
||
DropdownMenu[完成] | ||
Loading[完成] | ||
Notify[完成] | ||
Cell[完成] | ||
SwipeCell[完成] | ||
Slider[完成] | ||
|
||
Calendar[完成] | ||
Picker[完成] | ||
DatetimePicker[完成] | ||
Grid[完成] | ||
Sidebar[完成] | ||
|
||
|
||
蓝根 | ||
Popup[完成] | ||
ActionSheet[完成] | ||
Overlay[完成] | ||
Steps[完成] | ||
Stepper[完成] | ||
IndexBar[完成] | ||
ShareSheet[完成] | ||
|
||
TreeSelect[完成] | ||
Dialog[完成] | ||
Area[完成] | ||
|
||
三少 | ||
|
||
Button[完成] | ||
|
||
Icon[完成] | ||
|
||
Progress[完成] | ||
|
||
Skeleton[完成] | ||
|
||
CountDown[完成] | ||
|
||
Tag[完成] | ||
|
||
Sticky[完成] | ||
|
||
Rate[完成] | ||
```app.jsx | ||
import { Button } from '@antmjs/vantui' | ||
|
||
Search[完成] | ||
<Button onClick={() => { console.log('Hello World') }}>Hello World</Button> | ||
``` | ||
|
||
NavBar[完成] | ||
其他使用方式暂时请查看[有赞文档](https://youzan.github.io/vant-weapp/#/home) | ||
|
||
Tab[完成] | ||
#### 参与贡献的小伙伴 | ||
|
||
TabBar[完成] | ||
[![hisanshao](https://avatars.githubusercontent.com/u/26359618?s=100&v=4)](https://github.com/hisanshao/) | [![Chitanda60](https://avatars.githubusercontent.com/u/16026533?s=100&v=4)](https://github.com/Chitanda60/) | [![zuolung](https://avatars.githubusercontent.com/u/19684540?s=100&v=4)](https://github.com/Banlangenn/) | [![hisanshao](https://avatars.githubusercontent.com/u/28145148?s=100&v=4)](https://github.com/zuolung/) | ||
:---:|:---:|:---:|:---: | ||
[hisanshao](https://github.com/hisanshao/) | [Chitanda60](https://github.com/Chitanda60/) | [Banlangenn](https://github.com/Banlangenn/) | [zuolung](https://github.com/zuolung/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
### 博客地址 | ||
|
||
[点击查看](https://antmjs.github.io/vantui/) | ||
|
||
### 拽写文章说明 | ||
|
||
1. 拉取代码,执行 yarn install | ||
|
||
2. 切出一个独立的分支,执行 yarn run dev | ||
|
||
3. 更新 vant.config.js 的 nav 配置 | ||
|
||
```json | ||
{ | ||
"nav": [ | ||
{ | ||
"title": "博客", | ||
"items": [ | ||
{ | ||
"path": "home", | ||
"title": "简介", | ||
"hideSimulator": true | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "前端工程建设", | ||
"items": [ | ||
{ | ||
"path": "construction-home", | ||
"title": "概览", | ||
"hideSimulator": true | ||
} | ||
] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
注:不支持目录结构,所以如果有分组需求的可以以前缀作为分组,比如 construction-\* | ||
|
||
4. docs 目录里面添加 path 对应的 markdown 文件,比如 construction-\*.md,编辑文件 | ||
|
||
5. 提交 PR,Review 通过之后 yarn run build-site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ['@vant/cli/preset'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
### 简介 | ||
|
||
一套基于 Taro 框架开发的多端 UI 组件库 | ||
|
||
组件库99%基于有赞团队的[vant-weapp](https://github.com/youzan/vant-weapp)改造而来 | ||
|
||
#### 说明 | ||
|
||
- 为什么要做这个组件库?我们认为有赞团队的组件库经过了多年的实践积累,以及经过我们的实际体验之后认为确实是一款优秀的组件库,但可惜的是他们只提供了Vue版本和微信小程序版本,但我们的技术架构选用的是京东的Taro,所以就开始思考如何能把有赞微信小程序的版本迁移到Taro上面来,最终我们实现了@antmjs/vantui。 | ||
- 为什么是99%?迁移的步骤其实不难,第一步100%同步样式,第二步通过Taro convert转译之后再重构js部分,但因为有赞微信小程序的版本只完全基于微信小程序实现的,所以在兼容支付宝小程序、H5的时候还是存在不能100%兼容的情况,具体的个别差异点下面有提供。 | ||
|
||
#### 优势 | ||
|
||
- TS类型安全 | ||
- 目前支持微信小程序、支付宝小程序、H5。其他端逐渐更新中... | ||
|
||
#### 安装 | ||
|
||
yarn add @antmjs/vantui | ||
|
||
#### 差异点 | ||
- 组件属性均用驼峰代替 | ||
- slot改为传递通过属性传递ReactNode | ||
|
||
#### 使用 | ||
|
||
```app.less | ||
@import '@antmjs/vantui/dist/style/index.less'; | ||
|
||
page, | ||
body { | ||
font-size: 28px; | ||
} | ||
``` | ||
|
||
```app.jsx | ||
import { Button } from '@antmjs/vantui' | ||
|
||
<Button onClick={() => { console.log('Hello World') }}>Hello World</Button> | ||
``` | ||
|
||
其他使用方式暂时请查看[有赞文档](https://youzan.github.io/vant-weapp/#/home) | ||
|
||
#### 参与贡献的小伙伴 | ||
|
||
[![hisanshao](https://avatars.githubusercontent.com/u/26359618?s=100&v=4)](https://github.com/hisanshao/) | [![Chitanda60](https://avatars.githubusercontent.com/u/16026533?s=100&v=4)](https://github.com/Chitanda60/) | [![zuolung](https://avatars.githubusercontent.com/u/19684540?s=100&v=4)](https://github.com/Banlangenn/) | [![hisanshao](https://avatars.githubusercontent.com/u/28145148?s=100&v=4)](https://github.com/zuolung/) | ||
:---:|:---:|:---:|:---: | ||
[hisanshao](https://github.com/hisanshao/) | [Chitanda60](https://github.com/Chitanda60/) | [Banlangenn](https://github.com/Banlangenn/) | [zuolung](https://github.com/zuolung/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "vantui-doc", | ||
"private": true, | ||
"version": "0.0.1", | ||
"description": "", | ||
"scripts": { | ||
"dev": "npx vant-cli dev", | ||
"test": "npx vant-cli test", | ||
"build": "npx vant-cli build", | ||
"release": "npx vant-cli release", | ||
"test:coverage": "open test/coverage/index.html", | ||
"build-site": "npx vant-cli build-site && gh-pages -d site" | ||
}, | ||
"author": "sanshao", | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"vue": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@vant/cli": "^3.9.0", | ||
"@vue/compiler-sfc": "^3.0.0", | ||
"vue": "^3.0.0" | ||
}, | ||
"browserslist": [ | ||
"Chrome >= 51", | ||
"iOS >= 10" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# 占位文件 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
name: 'vantui-doc', | ||
build: { | ||
css: { | ||
preprocessor: 'less', | ||
}, | ||
site: { | ||
publicPath: '/vantui/', | ||
searchConfig: {}, | ||
}, | ||
}, | ||
site: { | ||
title: 'vantui', | ||
logo: 'https://img.yzcdn.cn/vant/logo.png', | ||
links: [ | ||
{ | ||
logo: 'https://b.yzcdn.cn/vant/logo/github.svg', | ||
url: 'https://github.com/antmjs/vantui', | ||
}, | ||
], | ||
nav: [ | ||
{ | ||
title: '基本介绍', | ||
items: [ | ||
{ | ||
path: 'home', | ||
title: '简介', | ||
hideSimulator: true, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
} |
Oops, something went wrong.