mirror of
https://github.com/youzan/vant.git
synced 2026-05-07 01:01:01 +08:00
Merge branch 'dev' into next
This commit is contained in:
@@ -156,6 +156,7 @@ export default {
|
||||
| title | Title | _string_ | - |
|
||||
| cancel-text | Text of cancel button | _string_ | - |
|
||||
| description | Description above the options | _string_ | - |
|
||||
| closeable `v2.10.5` | Whether to show close icon | _boolean_ | `true` |
|
||||
| close-icon | Close icon name | _string_ | `cross` |
|
||||
| duration | Transition duration, unit second | _number \| string_ | `0.3` |
|
||||
| round | Whether to show round corner | _boolean_ | `true` |
|
||||
|
||||
@@ -162,6 +162,7 @@ export default {
|
||||
| title | 顶部标题 | _string_ | - |
|
||||
| cancel-text | 取消按钮文字 | _string_ | - |
|
||||
| description | 选项上方的描述信息 | _string_ | - |
|
||||
| closeable `v2.10.5` | 是否显示关闭图标 | _boolean_ | `true` |
|
||||
| close-icon | 关闭[图标名称](#/zh-CN/icon)或图片链接 | _string_ | `cross` |
|
||||
| duration | 动画时长,单位秒 | _number \| string_ | `0.3` |
|
||||
| round | 是否显示圆角 | _boolean_ | `true` |
|
||||
|
||||
@@ -21,6 +21,10 @@ export default createComponent({
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
closeable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
closeIcon: {
|
||||
type: String,
|
||||
default: 'cross',
|
||||
@@ -50,11 +54,13 @@ export default createComponent({
|
||||
return (
|
||||
<div class={bem('header')}>
|
||||
{props.title}
|
||||
<Icon
|
||||
name={props.closeIcon}
|
||||
class={bem('close')}
|
||||
onClick={onCancel}
|
||||
/>
|
||||
{props.closeable && (
|
||||
<Icon
|
||||
name={props.closeIcon}
|
||||
class={bem('close')}
|
||||
onClick={onCancel}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -198,3 +198,15 @@ test('close-icon prop', () => {
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('closeable prop', () => {
|
||||
const wrapper = mount(ActionSheet, {
|
||||
propsData: {
|
||||
value: true,
|
||||
title: 'Title',
|
||||
closeable: false,
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user