mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
feat(ActionSheet): add color option (#2081)
This commit is contained in:
parent
086a5f9ff6
commit
13c8df1f25
@ -66,11 +66,13 @@ Page({
|
|||||||
cancel-text="取消"
|
cancel-text="取消"
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
|
show: false,
|
||||||
actions: [
|
actions: [
|
||||||
{ name: '选项'},
|
{ name: '选项', color: '07c160' },
|
||||||
{ loading: true },
|
{ loading: true },
|
||||||
{ name: '禁用选项', disabled: true }
|
{ name: '禁用选项', disabled: true }
|
||||||
]
|
]
|
||||||
@ -80,7 +82,7 @@ Page({
|
|||||||
|
|
||||||
### 展示取消按钮
|
### 展示取消按钮
|
||||||
|
|
||||||
设置cancelText属性后,会在底部展示取消按钮,点击后关闭当前菜单
|
设置`cancel-text`属`性后,会在底部展示取消按钮,点击后关闭当前菜单
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<van-action-sheet
|
<van-action-sheet
|
||||||
@ -92,7 +94,7 @@ Page({
|
|||||||
|
|
||||||
### 展示标题栏
|
### 展示标题栏
|
||||||
|
|
||||||
设置cancelText属性后,会在底部展示取消按钮,点击后关闭当前菜单
|
通过设置`title`属性展示标题栏,同时可以使用插槽自定义菜单内容
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<van-action-sheet show="{{ show }}" title="标题">
|
<van-action-sheet show="{{ show }}" title="标题">
|
||||||
@ -129,11 +131,12 @@ Page({
|
|||||||
|
|
||||||
`API`中的`actions`为一个对象数组,数组中的每一个对象配置每一列,每一列有以下`key`:
|
`API`中的`actions`为一个对象数组,数组中的每一个对象配置每一列,每一列有以下`key`:
|
||||||
|
|
||||||
| key | 说明 |
|
| 键名 | 说明 | 类型 |
|
||||||
|-----------|-----------|
|
|-----------|-----------|-----------|
|
||||||
| name | 标题 |
|
| name | 标题 | *string* |
|
||||||
| subname | 二级标题 |
|
| subname | 二级标题 | *string* |
|
||||||
| loading | 是否为加载状态 |
|
| color | 选项文字颜色 | *string* |
|
||||||
| disabled | 是否为禁用状态 |
|
| loading | 是否为加载状态 | *boolean* |
|
||||||
| className | 为对应列添加额外的 class 类名 |
|
| disabled | 是否为禁用状态 | *boolean* |
|
||||||
| openType | 微信开放能力,具体支持可参考 [微信官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/component/button.html) |
|
| className | 为对应列添加额外的 class 类名 | *string* |
|
||||||
|
| openType | 微信开放能力,具体支持可参考 [微信官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/component/button.html) | *string* |
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
wx:for="{{ actions }}"
|
wx:for="{{ actions }}"
|
||||||
wx:key="index"
|
wx:key="index"
|
||||||
open-type="{{ item.openType }}"
|
open-type="{{ item.openType }}"
|
||||||
|
style="{{ item.color ? 'color: ' + item.color : '' }}"
|
||||||
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
|
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
|
||||||
hover-class="van-action-sheet__item--hover"
|
hover-class="van-action-sheet__item--hover"
|
||||||
data-index="{{ index }}"
|
data-index="{{ index }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user