Skip to content

Commit 8336223

Browse files
committed
init
0 parents  commit 8336223

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+3414
-0
lines changed

Diff for: .DS_Store

8 KB
Binary file not shown.

Diff for: .babelrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"stage": 2,
3+
"optional": ["es7.classProperties"]
4+
}

Diff for: .eslintrc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"ecmaFeatures": {
3+
"jsx": true,
4+
"modules": true
5+
},
6+
"env": {
7+
"browser": true,
8+
"node": true
9+
},
10+
"parser": "babel-eslint",
11+
"rules": {
12+
"quotes": [2, "single"],
13+
"strict": [2, "never"],
14+
"react/jsx-uses-react": 2,
15+
"react/jsx-uses-vars": 2,
16+
"react/react-in-jsx-scope": 2
17+
},
18+
"plugins": [
19+
"react"
20+
]
21+
}

Diff for: .gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea
2+
coverage
3+
lib
4+
node_modules
5+
npm-debug.log

Diff for: .npmignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.*rc
2+
.*.yml
3+
.idea
4+
webpack.config.*
5+
docs
6+
test
7+
example
8+
coverage

Diff for: .travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- "stable"
4+
script:
5+
- npm test

Diff for: README.md

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
WeUI 为微信 Web 服务量身设计 [![Build Status](https://travis-ci.org/weui/react-weui.svg?branch=master)](https://travis-ci.org/weui/react-weui) [![npm version](https://img.shields.io/npm/v/react-weui.svg)](https://www.npmjs.org/package/react-weui)
2+
====
3+
4+
5+
### WeUI
6+
7+
WeUI是一套同微信原生视觉体验一致的基础样式库,由微信官方设计团队为微信 Web 开发量身设计,可以令用户的使用感知更加统一。包含`button``cell``dialog``progress``toast``article``icon`等各式组件。
8+
9+
[https://github.com/weui/weui](https://github.com/weui/weui)
10+
11+
### React-WeUI
12+
13+
使用`react`的方式来构建界面
14+
15+
### 目录结构
16+
17+
```
18+
react-weui
19+
├── README.md
20+
├── docs # 文档说明
21+
├── example # 示例代码
22+
├── index.js # react-weui
23+
├── package.json # package.json
24+
├── src # react-weui组件源码
25+
├── test # 测试文件
26+
└── webpack.config.js # webpack配置文件
27+
```
28+
29+
### 安装
30+
31+
```
32+
npm install weui react-weui --save
33+
```
34+
35+
### 使用
36+
37+
```javascript
38+
// app.js
39+
40+
import React from 'react';
41+
import ReactDOM from 'react-dom';
42+
import WeUI from 'react-weui';
43+
import 'weui';
44+
45+
const {Button} = WeUI;
46+
47+
class App extends React.Component {
48+
render() {
49+
return (
50+
<Button>hello wechat</Button>
51+
);
52+
}
53+
}
54+
55+
ReactDOM.render((
56+
<App/>
57+
), document.getElementById('container'));
58+
59+
```
60+
61+
### 开发
62+
63+
```
64+
git clone https://github.com/weui/react-weui
65+
cd react-weui
66+
npm install
67+
npm start
68+
```
69+
70+
71+
### 文档
72+
73+
- [快速上手](./docs/installation.md)
74+
- [ActionSheet](./docs/actionsheet.md)
75+
- [Button](./docs/button.md)
76+
- [Cell](./docs/cell.md)
77+
- [Dialog](./docs/dialog.md)
78+
- [Form](./docs/form.md)
79+
- [Icon](./docs/icon.md)
80+
- [Mask](./docs/mask.md)
81+
- [Msg](./docs/msg.md)
82+
- [Progress](./docs/progress.md)
83+
- [Toast](./docs/toast.md)
84+
85+
### 体验
86+
87+
![react-weui](./docs/qrcode.png)
88+
89+
[https://weui.github.io/react-weui](https://weui.github.io/react-weui)
90+
91+
### License
92+
93+
The MIT License([http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT))
94+
95+
请自由地享受和参与开源
96+
97+
### 贡献
98+
99+
如果你有好的意见或建议,欢迎给我们提 issue 或 pull request,为提升微信 web 体验贡献力量

Diff for: docs/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
3+
### 目录
4+
- [快速上手](./installation.md)
5+
- [ActionSheet](./actionsheet.md)
6+
- [Button](./button.md)
7+
- [Cell](./cell.md)
8+
- [Dialog](./dialog.md)
9+
- [Form](./form.md)
10+
- [Icon](./icon.md)
11+
- [Mask](./mask.md)
12+
- [Msg](./msg.md)
13+
- [Progress](./progress.md)
14+
- [Toast](./toast.md)

Diff for: docs/actionsheet.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
2+
3+
### ActionSheet
4+
5+
用于显示包含一系列可交互的动作集合,包括说明、跳转等。由底部弹出,一般用于响应用户对页面的点击。
6+
7+
#### 属性
8+
9+
属性名| 类型 | 默认值 | 可选值 | 备注 |
10+
------|------|--------|--------|------|
11+
menus |array |[ ] | |菜单描述,至少包含`label`属性|
12+
actions|array|[ ] | |动作描述,至少包含`label`属性|
13+
14+
例如:
15+
```javascript
16+
const menus = [{
17+
label: '拍照',
18+
onClick: ()=>{
19+
20+
}
21+
}, {
22+
label: '从手机相册中选择',
23+
onClick: ()=>{
24+
25+
}
26+
}];
27+
28+
const actions = [{
29+
label: '取消',
30+
onClick: ()=>{
31+
this.refs.actionsheet.hide();
32+
}
33+
}];
34+
```
35+
36+
#### 方法
37+
38+
- show 显示ActionSheet
39+
40+
- hide 隐藏ActionSheet
41+
42+
#### 示例
43+
44+
```javascript
45+
import React from 'react';
46+
import ReactDOM from 'react-dom';
47+
import {ActionSheet, Button} from '../../index';
48+
49+
class App extends React.Component {
50+
51+
state = {
52+
menus: [{
53+
label: '拍照',
54+
onClick: ()=>{
55+
56+
}
57+
}, {
58+
label: '从手机相册中选择',
59+
onClick: ()=>{
60+
61+
}
62+
}],
63+
actions: [{
64+
label: '取消',
65+
onClick: ()=>{
66+
this.refs.actionsheet.hide();
67+
}
68+
}]
69+
};
70+
71+
handleClick() {
72+
this.refs.actionsheet.show();
73+
}
74+
render() {
75+
return (
76+
<section style={{padding: `15px`}}>
77+
<Button onClick={this.handleClick.bind(this)}>选择</Button>
78+
<ActionSheet ref="actionsheet" menus={this.state.menus} actions={this.state.actions} />
79+
</section>
80+
);
81+
}
82+
}
83+
84+
ReactDOM.render((
85+
<App/>
86+
), document.getElementById('container'));
87+
```

Diff for: docs/button.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
3+
### 按钮
4+
5+
按钮常见的操作场景:确定(primary)、取消(default)、警示(warn).
6+
7+
### 属性
8+
9+
属性名称 | 类型 | 默认值 | 可选值
10+
------------- | ------------- | --------| -------------
11+
type | string | primary | primary, default, warn
12+
size | string | normal| normal, small
13+
plain | bool | false | false, true | 是否为空心按钮
14+
disabled | bool | false | false, true | 是否为禁用状态
15+
16+
17+
### 示例:
18+
19+
```javascript
20+
import React from 'react';
21+
import ReactDOM from 'react-dom';
22+
import {Button} from 'react-weui';
23+
24+
ReactDOM.render((
25+
<section>
26+
<Button type="primary">确认</Button>
27+
<Button type="default">取消</Button>
28+
<Button type="warn">警告</Button>
29+
30+
<Button type="primary" size="small">警告</Button>
31+
</section>
32+
), document.getElementById('container'));
33+
```
34+
35+
36+
### 按钮组
37+
38+
按钮组(ButtonArea), 通常用在Form, Msg底部,包裹1个或多个按钮. 排列方向可以分为水平排列(horizontal)和垂直排列(vertical).
39+
40+
41+
### 属性
42+
43+
属性名称 | 类型 | 默认值 | 可选值
44+
------------- | ------------- | --------| -------------
45+
direction | string | vertical | vertical, horizontal | 按钮排列方向
46+
47+
### 示例
48+
49+
```javascript
50+
import React from 'react';
51+
import ReactDOM from 'react-dom';
52+
import {ButtonArea, Button} from 'react-weui';
53+
54+
ReactDOM.render((
55+
<section>
56+
<ButtonArea>
57+
<Button>确定</Button>
58+
<Button type="default">取消</Button>
59+
</ButtonArea>
60+
61+
<ButtonArea direction="horizontal">
62+
<Button>确定</Button>
63+
<Button type="default">取消</Button>
64+
</ButtonArea>
65+
</section>
66+
), document.getElementById('container'));
67+
```

0 commit comments

Comments
 (0)