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 renderAction = (action, index) => {
|
||||||
const { icon, text, disabled, className } = action;
|
const { icon, text, disabled, className } = action;
|
||||||
return (
|
return (
|
||||||
<button
|
<div
|
||||||
type="button"
|
role="menuitem"
|
||||||
class={[bem('action', { disabled, 'with-icon': icon }), className]}
|
class={[bem('action', { disabled, 'with-icon': icon }), className]}
|
||||||
onClick={() => onClickAction(action, index)}
|
onClick={() => onClickAction(action, index)}
|
||||||
>
|
>
|
||||||
{icon && <Icon name={icon} class={bem('action-icon')} />}
|
{icon && <Icon name={icon} class={bem('action-icon')} />}
|
||||||
<div class={[bem('action-text'), BORDER_BOTTOM]}>{text}</div>
|
<div class={[bem('action-text'), BORDER_BOTTOM]}>{text}</div>
|
||||||
</button>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ export default createComponent({
|
|||||||
{...{ ...attrs, 'onUpdate:show': toggle }}
|
{...{ ...attrs, 'onUpdate:show': toggle }}
|
||||||
>
|
>
|
||||||
<div class={bem('arrow')} />
|
<div class={bem('arrow')} />
|
||||||
<div 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>
|
||||||
</Popup>
|
</Popup>
|
||||||
|
@ -34,8 +34,6 @@
|
|||||||
padding: 0 @padding-md;
|
padding: 0 @padding-md;
|
||||||
font-size: @popover-action-font-size;
|
font-size: @popover-action-font-size;
|
||||||
line-height: @line-height-md;
|
line-height: @line-height-md;
|
||||||
background-color: transparent;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`should allow to custom the className of action 1`] = `
|
exports[`should allow to custom the className of action 1`] = `
|
||||||
<button type="button"
|
<div role="menuitem"
|
||||||
class="van-popover__action foo"
|
class="van-popover__action foo"
|
||||||
>
|
>
|
||||||
<div class="van-popover__action-text van-hairline--bottom">
|
<div class="van-popover__action-text van-hairline--bottom">
|
||||||
Option
|
Option
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`should locate to reference element when showed 1`] = `
|
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 class="van-popover__arrow">
|
||||||
</div>
|
</div>
|
||||||
<div class="van-popover__content">
|
<div role="menu"
|
||||||
|
class="van-popover__content"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition-stub>
|
</transition-stub>
|
||||||
@ -36,7 +38,9 @@ exports[`should locate to reference element when showed 3`] = `
|
|||||||
>
|
>
|
||||||
<div class="van-popover__arrow">
|
<div class="van-popover__arrow">
|
||||||
</div>
|
</div>
|
||||||
<div class="van-popover__content">
|
<div role="menu"
|
||||||
|
class="van-popover__content"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition-stub>
|
</transition-stub>
|
||||||
@ -50,7 +54,9 @@ exports[`should watch placement prop and update location 1`] = `
|
|||||||
>
|
>
|
||||||
<div class="van-popover__arrow">
|
<div class="van-popover__arrow">
|
||||||
</div>
|
</div>
|
||||||
<div class="van-popover__content">
|
<div role="menu"
|
||||||
|
class="van-popover__content"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition-stub>
|
</transition-stub>
|
||||||
|
@ -89,7 +89,8 @@ export default {
|
|||||||
onChange(value) {
|
onChange(value) {
|
||||||
Toast.loading({ forbidClick: true });
|
Toast.loading({ forbidClick: true });
|
||||||
|
|
||||||
setTimeout(() => {
|
clearTimeout(this.timer);
|
||||||
|
this.timer = setTimeout(() => {
|
||||||
Toast.clear();
|
Toast.clear();
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}, 500);
|
}, 500);
|
||||||
|
@ -111,9 +111,9 @@ export default {
|
|||||||
onChange(value) {
|
onChange(value) {
|
||||||
Toast.loading({ forbidClick: true });
|
Toast.loading({ forbidClick: true });
|
||||||
|
|
||||||
setTimeout(() => {
|
clearTimeout(this.timer);
|
||||||
|
this.timer = setTimeout(() => {
|
||||||
Toast.clear();
|
Toast.clear();
|
||||||
|
|
||||||
// 注意此时修改 value 后会再次触发 change 事件
|
// 注意此时修改 value 后会再次触发 change 事件
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}, 500);
|
}, 500);
|
||||||
|
@ -89,7 +89,8 @@ export default {
|
|||||||
onChange(value) {
|
onChange(value) {
|
||||||
this.$toast.loading({ forbidClick: true });
|
this.$toast.loading({ forbidClick: true });
|
||||||
|
|
||||||
setTimeout(() => {
|
clearTimeout(this.timer);
|
||||||
|
this.timer = setTimeout(() => {
|
||||||
this.stepper6 = value;
|
this.stepper6 = value;
|
||||||
this.$toast.clear();
|
this.$toast.clear();
|
||||||
}, 500);
|
}, 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') => ({
|
const createListeners = (type: 'plus' | 'minus') => ({
|
||||||
onClick: (event: MouseEvent) => {
|
onClick: (event: MouseEvent) => {
|
||||||
// disable double tap scrolling on mobile safari
|
// disable double tap scrolling on mobile safari
|
||||||
@ -303,9 +311,10 @@ export default createComponent({
|
|||||||
aria-valuemax={+props.max}
|
aria-valuemax={+props.max}
|
||||||
aria-valuemin={+props.min}
|
aria-valuemin={+props.min}
|
||||||
aria-valuenow={+current.value}
|
aria-valuenow={+current.value}
|
||||||
|
onBlur={onBlur}
|
||||||
onInput={onInput}
|
onInput={onInput}
|
||||||
onFocus={onFocus}
|
onFocus={onFocus}
|
||||||
onBlur={onBlur}
|
onMousedown={onMousedown}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
v-show={props.showPlus}
|
v-show={props.showPlus}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user