mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-08-06 21:39:45 +08:00
[improvement] ActionSheet: support open-type (#516)
This commit is contained in:
parent
948f4f9290
commit
78b61c37b6
5
dist/action-sheet/index.wxml
vendored
5
dist/action-sheet/index.wxml
vendored
@ -11,9 +11,10 @@
|
||||
<van-icon custom-class="van-action-sheet__close" name="close" bind:click="onClose" />
|
||||
</view>
|
||||
<view wx:else class="van-hairline--bottom">
|
||||
<view
|
||||
<button
|
||||
wx:for="{{ actions }}"
|
||||
wx:key="index"
|
||||
open-type="{{ item.openType }}"
|
||||
class="van-action-sheet__item van-hairline--top {{ item.disabled || item.loading ? 'van-action-sheet__item--disabled' : '' }} {{ item.className || '' }}"
|
||||
data-index="{{ index }}"
|
||||
bind:tap="onSelect"
|
||||
@ -23,7 +24,7 @@
|
||||
<view class="van-action-sheet__subname" wx:if="{{ item.subname }}">{{ item.subname }}</view>
|
||||
</block>
|
||||
<van-loading wx:else custom-class="van-action-sheet__loading" size="20px" />
|
||||
</view>
|
||||
</button>
|
||||
</view>
|
||||
<view
|
||||
wx:if="{{ cancelText }}"
|
||||
|
2
dist/action-sheet/index.wxss
vendored
2
dist/action-sheet/index.wxss
vendored
@ -1 +1 @@
|
||||
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-action-sheet{color:#333;max-height:90%;overflow-y:auto;-webkit-overflow-scrolling:touch;background-color:#f8f8f8}.van-action-sheet--withtitle{background-color:#fff}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;line-height:50px;font-size:16px;text-align:center;background-color:#fff}.van-action-sheet__cancel:active,.van-action-sheet__item:active{background-color:#e8e8e8}.van-action-sheet__item--disabled{color:#c9c9c9}.van-action-sheet__item--disabled:active{background-color:#fff}.van-action-sheet__subname{font-size:12px;color:#666;margin-left:5px}.van-action-sheet__loading{display:inline-block}.van-action-sheet__cancel{margin-top:10px}.van-action-sheet__header{font-size:16px;line-height:44px;text-align:center}.van-action-sheet__close{top:0;right:0;padding:0 15px;font-size:18px!important;color:#999;position:absolute!important;line-height:inherit!important}
|
||||
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}.van-action-sheet{color:#333;max-height:90%;overflow-y:auto;-webkit-overflow-scrolling:touch;background-color:#f8f8f8}.van-action-sheet--withtitle{background-color:#fff}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;line-height:50px;font-size:16px;text-align:center;background-color:#fff}.van-action-sheet__cancel:active,.van-action-sheet__item:active{background-color:#e8e8e8}.van-action-sheet__item--disabled{color:#c9c9c9}.van-action-sheet__item--disabled:active{background-color:#fff}.van-action-sheet__name,.van-action-sheet__subname{display:inline-block}.van-action-sheet__subname{font-size:12px;color:#666;margin-left:5px}.van-action-sheet__loading{display:inline-block}.van-action-sheet__cancel{margin-top:10px}.van-action-sheet__header{font-size:16px;line-height:44px;text-align:center}.van-action-sheet__close{top:0;right:0;padding:0 15px;font-size:18px!important;color:#999;position:absolute!important;line-height:inherit!important}
|
@ -12,8 +12,8 @@ Page({
|
||||
this.setData({
|
||||
actions: [
|
||||
{ name: '选项' },
|
||||
{ name: '选项', subname: '禁用' },
|
||||
{ name: '选项', loading: true },
|
||||
{ name: '分享', subname: '描述信息', openType: 'share' },
|
||||
{ loading: true },
|
||||
{ name: '禁用选项', disabled: true }
|
||||
]
|
||||
});
|
||||
|
@ -32,11 +32,11 @@ Page({
|
||||
name: '选项'
|
||||
},
|
||||
{
|
||||
name: '选项',
|
||||
subname: '描述信息'
|
||||
name: '分享',
|
||||
subname: '描述信息',
|
||||
openType: 'share'
|
||||
},
|
||||
{
|
||||
name: '选项',
|
||||
loading: true
|
||||
},
|
||||
{
|
||||
@ -108,6 +108,7 @@ Page({
|
||||
|-----------|-----------|
|
||||
| name | 标题 |
|
||||
| subname | 二级标题 |
|
||||
| className | 为对应列添加额外的 class |
|
||||
| loading | 是否为加载状态 |
|
||||
| disabled | 是否为禁用状态 |
|
||||
| className | 为对应列添加额外的 class 类名 |
|
||||
| openType | 微信开放能力,具体支持可参考 [微信官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/component/button.html) |
|
||||
|
@ -11,9 +11,10 @@
|
||||
<van-icon custom-class="van-action-sheet__close" name="close" bind:click="onClose" />
|
||||
</view>
|
||||
<view wx:else class="van-hairline--bottom">
|
||||
<view
|
||||
<button
|
||||
wx:for="{{ actions }}"
|
||||
wx:key="index"
|
||||
open-type="{{ item.openType }}"
|
||||
class="van-action-sheet__item van-hairline--top {{ item.disabled || item.loading ? 'van-action-sheet__item--disabled' : '' }} {{ item.className || '' }}"
|
||||
data-index="{{ index }}"
|
||||
bind:tap="onSelect"
|
||||
@ -23,7 +24,7 @@
|
||||
<view class="van-action-sheet__subname" wx:if="{{ item.subname }}">{{ item.subname }}</view>
|
||||
</block>
|
||||
<van-loading wx:else custom-class="van-action-sheet__loading" size="20px" />
|
||||
</view>
|
||||
</button>
|
||||
</view>
|
||||
<view
|
||||
wx:if="{{ cancelText }}"
|
||||
|
@ -64,7 +64,7 @@
|
||||
| loading | 是否显示为加载状态 | `Boolean` | `false` |
|
||||
| block | 是否为块级元素 | `Boolean` | `false` |
|
||||
| square | 是否为方形按钮 | `Boolean` | `false` |
|
||||
| open-type | 微信开放能力 | `String` | - |
|
||||
| open-type | 微信开放能力,具体支持可参考 [微信官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/component/button.html) | `String` | - |
|
||||
| app-parameter | 打开 APP 时,向 APP 传递的参数 | `String` | - |
|
||||
| hover-start-time | 按住后多久出现点击态,单位毫秒 | `Number` | 20 |
|
||||
| hover-stay-time | 手指松开后点击态保留时间,单位毫秒 | `Number` | 70 |
|
||||
|
Loading…
x
Reference in New Issue
Block a user