diff --git a/README.md b/README.md
index 1c0adb1f..4372fd45 100644
--- a/README.md
+++ b/README.md
@@ -59,12 +59,12 @@ npm run dev
```json
{
"usingComponents": {
- "van-button": "/path/to/vant-weapp/dist/btn/index"
+ "van-button": "/path/to/vant-weapp/dist/button/index"
}
}
```
```html
-
+
按钮
```
diff --git a/dist/actionsheet/index.json b/dist/actionsheet/index.json
index 5ec84cb6..b5676868 100644
--- a/dist/actionsheet/index.json
+++ b/dist/actionsheet/index.json
@@ -1,6 +1,6 @@
{
"component": true,
"usingComponents": {
- "van-btn": "../btn/index"
+ "van-button": "../button/index"
}
}
diff --git a/dist/actionsheet/index.wxml b/dist/actionsheet/index.wxml
index 48c53780..63c0816d 100644
--- a/dist/actionsheet/index.wxml
+++ b/dist/actionsheet/index.wxml
@@ -5,17 +5,17 @@
>
-
-
+
{{ item.name }}
-
+
diff --git a/dist/actionsheet/index.wxss b/dist/actionsheet/index.wxss
index 101f00db..4bb37b21 100644
--- a/dist/actionsheet/index.wxss
+++ b/dist/actionsheet/index.wxss
@@ -1 +1 @@
-.van-actionsheet{background-color:#f8f8f8}.van-actionsheet__mask{position:fixed;top:0;left:0;right:0;bottom:0;z-index:10;background:rgba(0,0,0,.7);display:none}.van-actionsheet__container{position:fixed;left:0;right:0;bottom:0;background:#f8f8f8;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);-webkit-transform-origin:center;transform-origin:center;-webkit-transition:all .2s ease;transition:all .2s ease;z-index:11;opacity:0;visibility:hidden}.van-actionsheet__btn{margin-bottom:0!important}.van-actionsheet__footer .van-actionsheet__btn{background:#fff}.van-actionsheet__btn-content{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-pack:center;justify-content:center}.van-actionsheet__subname{color:#999}.van-actionsheet__name,.van-actionsheet__subname{height:45px;line-height:45px}.van-actionsheet__btn.van-btn:last-child::after{border-bottom-width:0}.van-actionsheet__subname{margin-left:2px;font-size:12px}.van-actionsheet__footer{margin-top:10px}.van-actionsheet__btn--loading .van-actionsheet__subname{color:transparent}.van-actionsheet--show .van-actionsheet__container{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);visibility:visible}.van-actionsheet--show .van-actionsheet__mask{display:block}
\ No newline at end of file
+.van-actionsheet{background-color:#f8f8f8}.van-actionsheet__mask{position:fixed;top:0;left:0;right:0;bottom:0;z-index:10;background:rgba(0,0,0,.7);display:none}.van-actionsheet__container{position:fixed;left:0;right:0;bottom:0;background:#f8f8f8;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);-webkit-transform-origin:center;transform-origin:center;-webkit-transition:all .2s ease;transition:all .2s ease;z-index:11;opacity:0;visibility:hidden}.van-actionsheet__button{margin-bottom:0!important}.van-actionsheet__footer .van-actionsheet__button{background:#fff}.van-actionsheet__button-content{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-pack:center;justify-content:center}.van-actionsheet__subname{color:#999}.van-actionsheet__name,.van-actionsheet__subname{height:45px;line-height:45px}.van-actionsheet__button.van-button:last-child::after{border-bottom-width:0}.van-actionsheet__subname{margin-left:2px;font-size:12px}.van-actionsheet__footer{margin-top:10px}.van-actionsheet__button--loading .van-actionsheet__subname{color:transparent}.van-actionsheet--show .van-actionsheet__container{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);visibility:visible}.van-actionsheet--show .van-actionsheet__mask{display:block}
\ No newline at end of file
diff --git a/dist/btn-group/index.js b/dist/btn-group/index.js
index 18a7de24..c8965284 100644
--- a/dist/btn-group/index.js
+++ b/dist/btn-group/index.js
@@ -2,7 +2,7 @@
Component({
relations: {
- '../btn/index': {
+ '../button/index': {
type: 'child',
linked: function linked() {
updateBtnChild.call(this);
@@ -18,13 +18,13 @@ Component({
});
function updateBtnChild() {
- var btns = this.getRelationNodes('../btn/index');
+ var buttons = this.getRelationNodes('../button/index');
- if (btns.length > 0) {
- var lastIndex = btns.length - 1;
+ if (buttons.length > 0) {
+ var lastIndex = buttons.length - 1;
- btns.forEach(function (btn, index) {
- btn.switchLastButtonStatus(index === lastIndex);
+ buttons.forEach(function (button, index) {
+ button.switchLastButtonStatus(index === lastIndex);
});
}
}
\ No newline at end of file
diff --git a/dist/btn-group/index.wxml b/dist/btn-group/index.wxml
index aa76fe4d..0dd98c36 100644
--- a/dist/btn-group/index.wxml
+++ b/dist/btn-group/index.wxml
@@ -1,3 +1,3 @@
-
+
diff --git a/dist/btn-group/index.wxss b/dist/btn-group/index.wxss
index 88223f09..ff9785d2 100644
--- a/dist/btn-group/index.wxss
+++ b/dist/btn-group/index.wxss
@@ -1,3 +1,3 @@
-.btn-group {
+.button-group {
margin: 15px;
}
diff --git a/dist/btn/index.js b/dist/btn/index.js
index 1ec7783a..9f73bfb3 100644
--- a/dist/btn/index.js
+++ b/dist/btn/index.js
@@ -6,7 +6,7 @@ Component({
externalClasses: ['custom-class', 'theme-class'],
behaviors: [nativeButtonBehavior],
relations: {
- '../btn-group/index': {
+ '../button-group/index': {
type: 'parent',
linked: function linked() {
this.setData({ inGroup: true });
@@ -50,7 +50,7 @@ Component({
this.triggerEvent('disabledclick');
return;
}
- this.triggerEvent('btnclick');
+ this.triggerEvent('buttonclick');
},
switchLastButtonStatus: function switchLastButtonStatus() {
var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
diff --git a/dist/btn/index.wxml b/dist/btn/index.wxml
index 4ad687b9..0290c18a 100644
--- a/dist/btn/index.wxml
+++ b/dist/btn/index.wxml
@@ -1,5 +1,5 @@
diff --git a/packages/btn-group/index.wxml b/packages/btn-group/index.wxml
deleted file mode 100644
index aa76fe4d..00000000
--- a/packages/btn-group/index.wxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/packages/btn-group/index.js b/packages/button-group/index.js
similarity index 54%
rename from packages/btn-group/index.js
rename to packages/button-group/index.js
index 89d8800e..724e7228 100644
--- a/packages/btn-group/index.js
+++ b/packages/button-group/index.js
@@ -1,6 +1,6 @@
Component({
relations: {
- '../btn/index': {
+ '../button/index': {
type: 'child',
linked() {
updateBtnChild.call(this);
@@ -16,13 +16,13 @@ Component({
});
function updateBtnChild() {
- let btns = this.getRelationNodes('../btn/index');
+ let buttons = this.getRelationNodes('../button/index');
- if (btns.length > 0) {
- let lastIndex = btns.length - 1;
+ if (buttons.length > 0) {
+ let lastIndex = buttons.length - 1;
- btns.forEach((btn, index) => {
- btn.switchLastButtonStatus(index === lastIndex);
+ buttons.forEach((button, index) => {
+ button.switchLastButtonStatus(index === lastIndex);
});
}
}
diff --git a/packages/btn-group/index.json b/packages/button-group/index.json
similarity index 100%
rename from packages/btn-group/index.json
rename to packages/button-group/index.json
diff --git a/packages/button-group/index.wxml b/packages/button-group/index.wxml
new file mode 100644
index 00000000..0dd98c36
--- /dev/null
+++ b/packages/button-group/index.wxml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/packages/btn-group/index.wxss b/packages/button-group/index.wxss
similarity index 52%
rename from packages/btn-group/index.wxss
rename to packages/button-group/index.wxss
index 88223f09..ff9785d2 100644
--- a/packages/btn-group/index.wxss
+++ b/packages/button-group/index.wxss
@@ -1,3 +1,3 @@
-.btn-group {
+.button-group {
margin: 15px;
}
diff --git a/packages/btn/README.md b/packages/button/README.md
similarity index 93%
rename from packages/btn/README.md
rename to packages/button/README.md
index c2b946a3..685a3183 100644
--- a/packages/btn/README.md
+++ b/packages/button/README.md
@@ -4,7 +4,7 @@
在 json 文件中配置button组件
```json
"usingComponents": {
- "van-button": "path/to/vant-weapp/dist/btn/index"
+ "van-button": "path/to/vant-weapp/dist/button/index"
}
```
@@ -53,8 +53,8 @@
1.在 json 文件中配置 button-group 组件
```json
"usingComponents": {
- "van-button": "path/to/vant-weapp/dist/btn/index",
- "van-button-group": "path/to/vant-weapp/dist/btn-group/index"
+ "van-button": "path/to/vant-weapp/dist/button/index",
+ "van-button-group": "path/to/vant-weapp/dist/button-group/index"
}
```
2.在 wxml 中直接引入
@@ -90,7 +90,7 @@
### 事件
| 事件名称 | 说明 | 回调参数 |
|-----------|-----------|-----------|
-| btnclick | 按钮在可用状态被点击时触发 | |
+| buttonclick | 按钮在可用状态被点击时触发 | |
| disabledclick | 在传入的 disabled 为 true 时,点击按钮会触发此事件 | |
| getuserinfo | 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同wx.getUserInfo | |
| contact | 客服消息回调 | |
diff --git a/packages/btn/index.js b/packages/button/index.js
similarity index 88%
rename from packages/btn/index.js
rename to packages/button/index.js
index 3d4db84d..65a0bc71 100644
--- a/packages/btn/index.js
+++ b/packages/button/index.js
@@ -4,7 +4,7 @@ Component({
externalClasses: ['custom-class', 'theme-class'],
behaviors: [nativeButtonBehavior],
relations: {
- '../btn-group/index': {
+ '../button-group/index': {
type: 'parent',
linked() {
this.setData({ inGroup: true });
@@ -45,10 +45,10 @@ Component({
methods: {
handleTap() {
if (this.data.disabled) {
- this.triggerEvent('disabledclick')
+ this.triggerEvent('disabledclick');
return;
}
- this.triggerEvent('btnclick');
+ this.triggerEvent('buttonclick');
},
switchLastButtonStatus(isLast = false) {
diff --git a/packages/btn/index.json b/packages/button/index.json
similarity index 100%
rename from packages/btn/index.json
rename to packages/button/index.json
diff --git a/packages/btn/index.pcss b/packages/button/index.pcss
similarity index 74%
rename from packages/btn/index.pcss
rename to packages/button/index.pcss
index f4f4d963..37180a0b 100644
--- a/packages/btn/index.pcss
+++ b/packages/button/index.pcss
@@ -1,6 +1,6 @@
@import "../common/_mixins";
-.van-btn {
+.van-button {
position: relative;
color: #333;
background-color: #fff;
@@ -17,18 +17,18 @@
overflow: visible;
}
-.van-btn--group {
+.van-button--group {
margin-bottom: 10px;
}
-.van-btn::after {
+.van-button::after {
@mixin hairline;
border-width: 1px;
border-radius: 4px;
}
/* type */
-.van-btn--primary {
+.van-button--primary {
color: #fff;
background-color: #4b0;
@@ -37,7 +37,7 @@
}
}
-.van-btn--warn {
+.van-button--warn {
color: #fff;
background-color: #f85;
@@ -46,7 +46,7 @@
}
}
-.van-btn--danger {
+.van-button--danger {
color: #fff;
background-color: #f44;
@@ -56,19 +56,19 @@
}
/* size */
-.van-btn--small {
+.van-button--small {
display: inline-block;
height: 30px;
line-height: 30px;
font-size: 12px;
/* margin-right: 5px; */
}
-.van-btn--small.van-btn--group {
+.van-button--small.van-button--group {
margin-bottom: 0;
margin-right: 5px;
}
-.van-btn--mini {
+.van-button--mini {
display: inline-block;
line-height: 21px;
height: 22px;
@@ -77,32 +77,32 @@
padding-left: 5px;
padding-right: 5px;
}
-.van-btn--mini.van-btn--group {
+.van-button--mini.van-button--group {
margin-bottom: 0;
margin-right: 5px;
}
-.van-btn--large {
+.van-button--large {
border-radius: 0;
border: none;
line-height: 50px;
height: 50px;
}
-.van-btn--large.van-btn--group {
+.van-button--large.van-button--group {
margin-bottom: 0;
}
/* plain */
-.van-btn--plain.van-btn {
+.van-button--plain.van-button {
background-color: transparent;
}
-.van-btn--plain.van-btn--primary {
+.van-button--plain.van-button--primary {
color: #06BF04;
}
-.van-btn--plain.van-btn--warn {
+.van-button--plain.van-button--warn {
color: #FF6600;
}
-.van-btn--plain.van-btn--danger {
+.van-button--plain.van-button--danger {
color: #FF4444;
}
@@ -112,11 +112,11 @@
}
/* loading */
-.van-btn--loading {
+.van-button--loading {
color: transparent;
opacity: 1;
}
-.van-btn--loading::before {
+.van-button--loading::before {
position: absolute;
left: 50%;
top: 50%;
@@ -129,16 +129,16 @@
border-color: #666 #e5e5e5 #e5e5e5 #e5e5e5;
border-radius: 8px;
box-sizing: border-box;
- animation: btn-spin 0.6s linear;
+ animation: button-spin 0.6s linear;
animation-iteration-count: infinite;
}
-.van-btn--primary.van-btn--loading::before,
-.van-btn--warn.van-btn--loading::before,
-.van-btn--danger.van-btn--loading::before {
+.van-button--primary.van-button--loading::before,
+.van-button--warn.van-button--loading::before,
+.van-button--danger.van-button--loading::before {
border-color: #fff rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1);
}
-@keyframes btn-spin {
+@keyframes button-spin {
0% {
transform: rotate(0);
}
@@ -148,7 +148,7 @@
}
/* disabled */
-.van-btn.van-btn--disabled {
+.van-button.van-button--disabled {
/* 防止样式被 button[disabled] 的规则覆盖,所以使用了important */
color: #999 ! important;
background: #f8f8f8 ! important;
@@ -162,7 +162,7 @@
}
/* :last-child */
-.van-btn--group.van-btn--last {
+.van-button--group.van-button--last {
margin-bottom: 0;
margin-right: 0;
}
diff --git a/packages/btn/index.wxml b/packages/button/index.wxml
similarity index 66%
rename from packages/btn/index.wxml
rename to packages/button/index.wxml
index 4ad687b9..0290c18a 100644
--- a/packages/btn/index.wxml
+++ b/packages/button/index.wxml
@@ -1,5 +1,5 @@