mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-24 23:49:14 +08:00
Merge branch '2.x' into dev
This commit is contained in:
commit
9a6449ec31
@ -126,14 +126,14 @@ export default createComponent({
|
||||
const renderAction = (action, index) => {
|
||||
const { icon, text, disabled, className } = action;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
<div
|
||||
role="menuitem"
|
||||
class={[bem('action', { disabled, 'with-icon': icon }), className]}
|
||||
onClick={() => onClickAction(action, index)}
|
||||
>
|
||||
{icon && <Icon name={icon} class={bem('action-icon')} />}
|
||||
<div class={[bem('action-text'), BORDER_BOTTOM]}>{text}</div>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@ -167,7 +167,7 @@ export default createComponent({
|
||||
{...{ ...attrs, 'onUpdate:show': toggle }}
|
||||
>
|
||||
<div class={bem('arrow')} />
|
||||
<div class={bem('content')}>
|
||||
<div role="menu" class={bem('content')}>
|
||||
{slots.default ? slots.default() : props.actions.map(renderAction)}
|
||||
</div>
|
||||
</Popup>
|
||||
|
@ -34,8 +34,6 @@
|
||||
padding: 0 @padding-md;
|
||||
font-size: @popover-action-font-size;
|
||||
line-height: @line-height-md;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
|
||||
&:last-child {
|
||||
|
@ -1,13 +1,13 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`should allow to custom the className of action 1`] = `
|
||||
<button type="button"
|
||||
<div role="menuitem"
|
||||
class="van-popover__action foo"
|
||||
>
|
||||
<div class="van-popover__action-text van-hairline--bottom">
|
||||
Option
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should locate to reference element when showed 1`] = `
|
||||
@ -23,7 +23,9 @@ exports[`should locate to reference element when showed 2`] = `
|
||||
>
|
||||
<div class="van-popover__arrow">
|
||||
</div>
|
||||
<div class="van-popover__content">
|
||||
<div role="menu"
|
||||
class="van-popover__content"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
@ -36,7 +38,9 @@ exports[`should locate to reference element when showed 3`] = `
|
||||
>
|
||||
<div class="van-popover__arrow">
|
||||
</div>
|
||||
<div class="van-popover__content">
|
||||
<div role="menu"
|
||||
class="van-popover__content"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
@ -50,7 +54,9 @@ exports[`should watch placement prop and update location 1`] = `
|
||||
>
|
||||
<div class="van-popover__arrow">
|
||||
</div>
|
||||
<div class="van-popover__content">
|
||||
<div role="menu"
|
||||
class="van-popover__content"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
|
@ -89,7 +89,8 @@ export default {
|
||||
onChange(value) {
|
||||
Toast.loading({ forbidClick: true });
|
||||
|
||||
setTimeout(() => {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
Toast.clear();
|
||||
this.value = value;
|
||||
}, 500);
|
||||
|
@ -111,9 +111,9 @@ export default {
|
||||
onChange(value) {
|
||||
Toast.loading({ forbidClick: true });
|
||||
|
||||
setTimeout(() => {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
Toast.clear();
|
||||
|
||||
// 注意此时修改 value 后会再次触发 change 事件
|
||||
this.value = value;
|
||||
}, 500);
|
||||
|
@ -89,7 +89,8 @@ export default {
|
||||
onChange(value) {
|
||||
this.$toast.loading({ forbidClick: true });
|
||||
|
||||
setTimeout(() => {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.stepper6 = value;
|
||||
this.$toast.clear();
|
||||
}, 500);
|
||||
|
@ -238,6 +238,14 @@ export default createComponent({
|
||||
}
|
||||
};
|
||||
|
||||
const onMousedown = (event: MouseEvent) => {
|
||||
// fix mobile safari page scroll down issue
|
||||
// see: https://github.com/youzan/vant/issues/7690
|
||||
if (props.disableInput) {
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
const createListeners = (type: 'plus' | 'minus') => ({
|
||||
onClick: (event: MouseEvent) => {
|
||||
// disable double tap scrolling on mobile safari
|
||||
@ -303,9 +311,10 @@ export default createComponent({
|
||||
aria-valuemax={+props.max}
|
||||
aria-valuemin={+props.min}
|
||||
aria-valuenow={+current.value}
|
||||
onBlur={onBlur}
|
||||
onInput={onInput}
|
||||
onFocus={onFocus}
|
||||
onBlur={onBlur}
|
||||
onMousedown={onMousedown}
|
||||
/>
|
||||
<button
|
||||
v-show={props.showPlus}
|
||||
|
Loading…
x
Reference in New Issue
Block a user