mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-27 03:46:38 +08:00
[new feature] Button: 增加新属性 ariaLabel、增加外部样式类 hover-class、增加launchapp事件
This commit is contained in:
parent
705aa8c1df
commit
386322b44a
@ -2,35 +2,35 @@
|
|||||||
|
|
||||||
.van-button {
|
.van-button {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 0;
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 44px;
|
height: 44px;
|
||||||
|
padding: 0;
|
||||||
|
font-size: 16px;
|
||||||
line-height: 42px;
|
line-height: 42px;
|
||||||
|
text-align: center;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
vertical-align: middle;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-size: 16px;
|
|
||||||
text-align: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
-webkit-text-size-adjust: 100%;
|
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: " ";
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
opacity: 0;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
background-color: @black;
|
||||||
border: inherit;
|
border: inherit;
|
||||||
border-color: @black;
|
border-color: @black;
|
||||||
background-color: @black;
|
|
||||||
border-radius: inherit; /* inherit parent's border radius */
|
border-radius: inherit; /* inherit parent's border radius */
|
||||||
|
content: ' ';
|
||||||
|
opacity: 0;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active::after {
|
&--active::after {
|
||||||
opacity: .15;
|
opacity: 0.15;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--unclickable::after {
|
&--unclickable::after {
|
||||||
@ -90,8 +90,8 @@
|
|||||||
|
|
||||||
&--small {
|
&--small {
|
||||||
height: 30px;
|
height: 30px;
|
||||||
padding: 0 8px;
|
|
||||||
min-width: 60px;
|
min-width: 60px;
|
||||||
|
padding: 0 8px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
}
|
}
|
||||||
@ -101,8 +101,8 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 50px;
|
width: 50px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
line-height: 20px;
|
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
line-height: 20px;
|
||||||
|
|
||||||
& + .van-button--mini {
|
& + .van-button--mini {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
@ -110,8 +110,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&--block {
|
&--block {
|
||||||
width: 100%;
|
|
||||||
display: block;
|
display: block;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--round {
|
&--round {
|
||||||
@ -123,6 +123,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&--disabled {
|
&--disabled {
|
||||||
opacity: .5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@ import { button } from '../mixins/button';
|
|||||||
import { openType } from '../mixins/open-type';
|
import { openType } from '../mixins/open-type';
|
||||||
|
|
||||||
VantComponent({
|
VantComponent({
|
||||||
classes: ['loading-class'],
|
|
||||||
|
|
||||||
mixins: [button, openType],
|
mixins: [button, openType],
|
||||||
|
|
||||||
|
classes: ['hover-class', 'loading-class'],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
plain: Boolean,
|
plain: Boolean,
|
||||||
block: Boolean,
|
block: Boolean,
|
||||||
|
@ -2,21 +2,26 @@
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
id="{{ id }}"
|
id="{{ id }}"
|
||||||
lang="{{ lang }}"
|
|
||||||
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, unclickable: disabled || loading }]) }}"
|
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, unclickable: disabled || loading }]) }}"
|
||||||
|
|
||||||
open-type="{{ openType }}"
|
open-type="{{ openType }}"
|
||||||
|
hover-class="van-button--active hover-class"
|
||||||
|
lang="{{ lang }}"
|
||||||
session-from="{{ sessionFrom }}"
|
session-from="{{ sessionFrom }}"
|
||||||
app-parameter="{{ appParameter }}"
|
|
||||||
send-message-img="{{ sendMessageImg }}"
|
|
||||||
send-message-path="{{ sendMessagePath }}"
|
|
||||||
show-message-card="{{ showMessageCard }}"
|
|
||||||
send-message-title="{{ sendMessageTitle }}"
|
send-message-title="{{ sendMessageTitle }}"
|
||||||
bind:tap="onClick"
|
send-message-path="{{ sendMessagePath }}"
|
||||||
binderror="bindError"
|
send-message-img="{{ sendMessageImg }}"
|
||||||
bindcontact="bindContact"
|
show-message-card="{{ showMessageCard }}"
|
||||||
bindopensetting="bindOpenSetting"
|
app-parameter="{{ appParameter }}"
|
||||||
|
aria-label="{{ ariaLabel }}"
|
||||||
|
|
||||||
|
bindtap="onClick"
|
||||||
bindgetuserinfo="bindGetUserInfo"
|
bindgetuserinfo="bindGetUserInfo"
|
||||||
|
bindcontact="bindContact"
|
||||||
bindgetphonenumber="bindGetPhoneNumber"
|
bindgetphonenumber="bindGetPhoneNumber"
|
||||||
|
binderror="bindError"
|
||||||
|
bindlaunchapp="bindLaunchApp"
|
||||||
|
bindopensetting="bindOpenSetting"
|
||||||
>
|
>
|
||||||
<van-loading
|
<van-loading
|
||||||
wx:if="{{ loading }}"
|
wx:if="{{ loading }}"
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
export const button = Behavior({
|
export const button = Behavior({
|
||||||
|
externalClasses: ['hover-class'],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
id: String,
|
id: String,
|
||||||
sessionFrom: String,
|
|
||||||
appParameter: String,
|
|
||||||
sendMessageImg: String,
|
|
||||||
sendMessagePath: String,
|
|
||||||
showMessageCard: String,
|
|
||||||
sendMessageTitle: String,
|
|
||||||
lang: {
|
lang: {
|
||||||
type: String,
|
type: String,
|
||||||
value: 'en'
|
value: 'en'
|
||||||
},
|
},
|
||||||
|
sessionFrom: String,
|
||||||
|
sendMessageTitle: String,
|
||||||
|
sendMessagePath: String,
|
||||||
|
sendMessageImg: String,
|
||||||
|
showMessageCard: String,
|
||||||
|
appParameter: String,
|
||||||
|
ariaLabel: String
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -16,12 +16,16 @@ export const openType = Behavior({
|
|||||||
this.$emit('getphonenumber', event.detail);
|
this.$emit('getphonenumber', event.detail);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
bindError(event: Partial<Weapp.Event>) {
|
||||||
|
this.$emit('error', event.detail);
|
||||||
|
},
|
||||||
|
|
||||||
|
bindLaunchApp(event: Partial<Weapp.Event>) {
|
||||||
|
this.$emit('launchapp', event.detail);
|
||||||
|
},
|
||||||
|
|
||||||
bindOpenSetting(event: Partial<Weapp.Event>) {
|
bindOpenSetting(event: Partial<Weapp.Event>) {
|
||||||
this.$emit('opensetting', event.detail);
|
this.$emit('opensetting', event.detail);
|
||||||
},
|
},
|
||||||
|
|
||||||
bindError(event: Partial<Weapp.Event>) {
|
|
||||||
this.$emit('error', event.detail);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user