mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-24 18:36:51 +08:00
feat(Popover): add show-arrow prop (#9372)
This commit is contained in:
parent
d3316ab4d5
commit
93e0a95c1d
@ -102,6 +102,10 @@ export default defineComponent({
|
|||||||
type: [String, Object] as PropType<TeleportProps['to']>,
|
type: [String, Object] as PropType<TeleportProps['to']>,
|
||||||
default: 'body',
|
default: 'body',
|
||||||
},
|
},
|
||||||
|
showArrow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ['select', 'touchstart', 'update:show'],
|
emits: ['select', 'touchstart', 'update:show'],
|
||||||
@ -234,7 +238,7 @@ export default defineComponent({
|
|||||||
{...pick(props, popupProps)}
|
{...pick(props, popupProps)}
|
||||||
{...{ 'onUpdate:show': updateShow }}
|
{...{ 'onUpdate:show': updateShow }}
|
||||||
>
|
>
|
||||||
<div class={bem('arrow')} />
|
{props.showArrow && <div class={bem('arrow')} />}
|
||||||
<div role="menu" class={bem('content')}>
|
<div role="menu" class={bem('content')}>
|
||||||
{slots.default ? slots.default() : props.actions.map(renderAction)}
|
{slots.default ? slots.default() : props.actions.map(renderAction)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -220,6 +220,7 @@ export default {
|
|||||||
| overlay | Whether to show overlay | _boolean_ | `false` |
|
| overlay | Whether to show overlay | _boolean_ | `false` |
|
||||||
| overlay-class `v3.0.10` | Custom overlay class | _string \| Array \| object_ | - |
|
| overlay-class `v3.0.10` | Custom overlay class | _string \| Array \| object_ | - |
|
||||||
| overlay-style `v3.0.10` | Custom overlay style | _object_ | - |
|
| overlay-style `v3.0.10` | Custom overlay style | _object_ | - |
|
||||||
|
| show-arrow `v3.2.2` | Whether to show arrow | _boolean_ | `true` |
|
||||||
| close-on-click-action | Whether to close when clicking action | _boolean_ | `true` |
|
| close-on-click-action | Whether to close when clicking action | _boolean_ | `true` |
|
||||||
| close-on-click-outside | Whether to close when clicking outside | _boolean_ | `true` |
|
| close-on-click-outside | Whether to close when clicking outside | _boolean_ | `true` |
|
||||||
| close-on-click-overlay `v3.0.10` | Whether to close when clicking overlay | _boolean_ | `true` |
|
| close-on-click-overlay `v3.0.10` | Whether to close when clicking overlay | _boolean_ | `true` |
|
||||||
|
@ -230,6 +230,7 @@ export default {
|
|||||||
| overlay | 是否显示遮罩层 | _boolean_ | `false` |
|
| overlay | 是否显示遮罩层 | _boolean_ | `false` |
|
||||||
| overlay-class `v3.0.10` | 自定义遮罩层类名 | _string \| Array \| object_ | - |
|
| overlay-class `v3.0.10` | 自定义遮罩层类名 | _string \| Array \| object_ | - |
|
||||||
| overlay-style `v3.0.10` | 自定义遮罩层样式 | _object_ | - |
|
| overlay-style `v3.0.10` | 自定义遮罩层样式 | _object_ | - |
|
||||||
|
| show-arrow `v3.2.2` | 是否展示小箭头 | _boolean_ | `true` |
|
||||||
| close-on-click-action | 是否在点击选项后关闭 | _boolean_ | `true` |
|
| close-on-click-action | 是否在点击选项后关闭 | _boolean_ | `true` |
|
||||||
| close-on-click-outside | 是否在点击外部元素后关闭菜单 | _boolean_ | `true` |
|
| close-on-click-outside | 是否在点击外部元素后关闭菜单 | _boolean_ | `true` |
|
||||||
| close-on-click-overlay `v3.0.10` | 是否在点击遮罩层后关闭菜单 | _boolean_ | `true` |
|
| close-on-click-overlay `v3.0.10` | 是否在点击遮罩层后关闭菜单 | _boolean_ | `true` |
|
||||||
|
@ -200,3 +200,15 @@ test('should change icon class prefix when using icon-prefix prop', () => {
|
|||||||
|
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should allow to hide arrow', () => {
|
||||||
|
const wrapper = mount(Popover, {
|
||||||
|
props: {
|
||||||
|
show: true,
|
||||||
|
teleport: null,
|
||||||
|
showArrow: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper.find('.van-popover__arrow').exists()).toBeFalsy();
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user