mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-07-10 16:31:05 +08:00
Compare commits
No commits in common. "ec2ff5927083dcb9819f111e874bed29c8a5606a" and "baa1b0f074f5c69c0abe36d3f1dbcca46ba17e43" have entirely different histories.
ec2ff59270
...
baa1b0f074
@ -131,7 +131,7 @@ export default defineComponent({
|
||||
},
|
||||
direction.value,
|
||||
])}
|
||||
tabindex={disabled.value ? undefined : 0}
|
||||
tabindex={disabled.value ? -1 : 0}
|
||||
aria-checked={props.checked}
|
||||
onClick={onClick}
|
||||
>
|
||||
|
||||
@ -19,6 +19,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div>
|
||||
<div role="checkbox"
|
||||
class="van-checkbox van-checkbox--disabled"
|
||||
tabindex="-1"
|
||||
aria-checked="false"
|
||||
>
|
||||
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--disabled">
|
||||
@ -31,6 +32,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</div>
|
||||
<div role="checkbox"
|
||||
class="van-checkbox van-checkbox--disabled"
|
||||
tabindex="-1"
|
||||
aria-checked="true"
|
||||
>
|
||||
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--disabled van-checkbox__icon--checked">
|
||||
|
||||
@ -15,8 +15,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="false"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
@ -133,8 +131,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="false"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import {
|
||||
ref,
|
||||
watch,
|
||||
computed,
|
||||
nextTick,
|
||||
reactive,
|
||||
onMounted,
|
||||
defineComponent,
|
||||
ExtractPropTypes,
|
||||
@ -11,7 +11,6 @@ import {
|
||||
// Utils
|
||||
import {
|
||||
truthProp,
|
||||
windowHeight,
|
||||
makeArrayProp,
|
||||
makeStringProp,
|
||||
makeNumberProp,
|
||||
@ -27,7 +26,6 @@ import { Tabs } from '../tabs';
|
||||
import { Field } from '../field';
|
||||
import { Button } from '../button';
|
||||
import { Coupon, CouponInfo } from '../coupon';
|
||||
import { useRect } from '@vant/use';
|
||||
|
||||
const [name, bem, t] = createNamespace('coupon-list');
|
||||
const EMPTY_IMAGE = 'https://img.yzcdn.cn/vant/coupon-empty.png';
|
||||
@ -64,40 +62,34 @@ export default defineComponent({
|
||||
setup(props, { emit, slots }) {
|
||||
const [couponRefs, setCouponRefs] = useRefs();
|
||||
|
||||
const root = ref<HTMLElement>();
|
||||
const barRef = ref<HTMLElement>();
|
||||
const activeTab = ref(0);
|
||||
const listHeight = ref(0);
|
||||
const currentCode = ref(props.code);
|
||||
const state = reactive({
|
||||
tab: 0,
|
||||
code: props.code,
|
||||
});
|
||||
|
||||
const buttonDisabled = computed(
|
||||
() =>
|
||||
!props.exchangeButtonLoading &&
|
||||
(props.exchangeButtonDisabled ||
|
||||
!currentCode.value ||
|
||||
currentCode.value.length < props.exchangeMinLength)
|
||||
!state.code ||
|
||||
state.code.length < props.exchangeMinLength)
|
||||
);
|
||||
|
||||
const updateListHeight = () => {
|
||||
const TABS_HEIGHT = 44;
|
||||
const rootHeight = useRect(root).height;
|
||||
const headerHeight = useRect(barRef).height + TABS_HEIGHT;
|
||||
listHeight.value =
|
||||
(rootHeight > headerHeight ? rootHeight : windowHeight.value) -
|
||||
headerHeight;
|
||||
};
|
||||
|
||||
const onExchange = () => {
|
||||
emit('exchange', currentCode.value);
|
||||
emit('exchange', state.code);
|
||||
|
||||
// auto clear currentCode when not use v-model
|
||||
if (!props.code) {
|
||||
currentCode.value = '';
|
||||
state.code = '';
|
||||
}
|
||||
};
|
||||
|
||||
const scrollToCoupon = (index: number) => {
|
||||
nextTick(() => couponRefs.value[index]?.scrollIntoView());
|
||||
nextTick(() => {
|
||||
if (couponRefs.value[index]) {
|
||||
couponRefs.value[index].scrollIntoView();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const renderEmpty = () => (
|
||||
@ -110,9 +102,9 @@ export default defineComponent({
|
||||
const renderExchangeBar = () => {
|
||||
if (props.showExchangeBar) {
|
||||
return (
|
||||
<div ref={barRef} class={bem('exchange-bar')}>
|
||||
<div class={bem('exchange-bar')}>
|
||||
<Field
|
||||
v-model={currentCode.value}
|
||||
v-model={state.code}
|
||||
clearable
|
||||
border={false}
|
||||
class={bem('field')}
|
||||
@ -141,8 +133,10 @@ export default defineComponent({
|
||||
return (
|
||||
<Tab title={title}>
|
||||
<div
|
||||
class={bem('list', { 'with-bottom': props.showCloseButton })}
|
||||
style={{ height: `${listHeight.value}px` }}
|
||||
class={bem('list', {
|
||||
'with-bar': props.showExchangeBar,
|
||||
'with-bottom': props.showCloseButton,
|
||||
})}
|
||||
>
|
||||
{coupons.map((coupon, index) => (
|
||||
<Coupon
|
||||
@ -169,8 +163,10 @@ export default defineComponent({
|
||||
return (
|
||||
<Tab title={title}>
|
||||
<div
|
||||
class={bem('list', { 'with-bottom': props.showCloseButton })}
|
||||
style={{ height: `${listHeight.value}px` }}
|
||||
class={bem('list', {
|
||||
'with-bar': props.showExchangeBar,
|
||||
'with-bottom': props.showCloseButton,
|
||||
})}
|
||||
>
|
||||
{disabledCoupons.map((coupon) => (
|
||||
<Coupon
|
||||
@ -190,23 +186,25 @@ export default defineComponent({
|
||||
watch(
|
||||
() => props.code,
|
||||
(value) => {
|
||||
currentCode.value = value;
|
||||
state.code = value;
|
||||
}
|
||||
);
|
||||
|
||||
watch(windowHeight, updateListHeight);
|
||||
watch(currentCode, (value) => emit('update:code', value));
|
||||
watch(
|
||||
() => state.code,
|
||||
(value) => emit('update:code', value)
|
||||
);
|
||||
|
||||
watch(() => props.displayedCouponIndex, scrollToCoupon);
|
||||
|
||||
onMounted(() => {
|
||||
updateListHeight();
|
||||
scrollToCoupon(props.displayedCouponIndex);
|
||||
});
|
||||
|
||||
return () => (
|
||||
<div ref={root} class={bem()}>
|
||||
<div class={bem()}>
|
||||
{renderExchangeBar()}
|
||||
<Tabs v-model:active={activeTab.value} class={bem('tab')}>
|
||||
<Tabs v-model:active={state.tab} class={bem('tab')} border={false}>
|
||||
{renderCouponTab()}
|
||||
{renderDisabledTab()}
|
||||
</Tabs>
|
||||
|
||||
@ -56,10 +56,15 @@
|
||||
|
||||
&__list {
|
||||
box-sizing: border-box;
|
||||
height: calc(100vh - 108px);
|
||||
padding: var(--van-padding-md) 0 var(--van-padding-lg);
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
&--with-bar {
|
||||
height: calc(100vh - 152px);
|
||||
}
|
||||
|
||||
&--with-bottom {
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
|
||||
@ -59,9 +59,7 @@ exports[`should be the sames as the last snapshot when render coupon list 1`] =
|
||||
class="van-tab__pane"
|
||||
style
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bottom"
|
||||
style="height: 624px;"
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bar van-coupon-list__list--with-bottom">
|
||||
<div class="van-coupon">
|
||||
<div class="van-coupon__content">
|
||||
<div class="van-coupon__head">
|
||||
@ -340,9 +338,7 @@ exports[`should have two "van-coupon-list__empty" classes when render coupon lis
|
||||
class="van-tab__pane"
|
||||
style="display: none;"
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bottom"
|
||||
style="height: 624px;"
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bar van-coupon-list__list--with-bottom">
|
||||
<div class="van-coupon-list__empty">
|
||||
<img src="https://img.yzcdn.cn/vant/coupon-empty.png">
|
||||
<p>
|
||||
@ -355,9 +351,7 @@ exports[`should have two "van-coupon-list__empty" classes when render coupon lis
|
||||
class="van-tab__pane"
|
||||
style
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bottom"
|
||||
style="height: 624px;"
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bar van-coupon-list__list--with-bottom">
|
||||
<div class="van-coupon-list__empty">
|
||||
<img src="https://img.yzcdn.cn/vant/coupon-empty.png">
|
||||
<p>
|
||||
@ -441,9 +435,7 @@ exports[`should render list-footer slot correctly 1`] = `
|
||||
class="van-tab__pane"
|
||||
style="display: none;"
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bottom"
|
||||
style="height: 624px;"
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bar van-coupon-list__list--with-bottom">
|
||||
<div class="van-coupon-list__empty">
|
||||
<img src="https://img.yzcdn.cn/vant/coupon-empty.png">
|
||||
<p>
|
||||
@ -457,9 +449,7 @@ exports[`should render list-footer slot correctly 1`] = `
|
||||
class="van-tab__pane"
|
||||
style
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bottom"
|
||||
style="height: 624px;"
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bar van-coupon-list__list--with-bottom">
|
||||
<div class="van-coupon-list__empty">
|
||||
<img src="https://img.yzcdn.cn/vant/coupon-empty.png">
|
||||
<p>
|
||||
@ -544,9 +534,7 @@ exports[`should use custom src when using empty-image prop 1`] = `
|
||||
class="van-tab__pane"
|
||||
style
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bottom"
|
||||
style="height: 624px;"
|
||||
>
|
||||
<div class="van-coupon-list__list van-coupon-list__list--with-bar van-coupon-list__list--with-bottom">
|
||||
<div class="van-coupon-list__empty">
|
||||
<img src="https://img.yzcdn.com/xxx.png">
|
||||
<p>
|
||||
|
||||
@ -116,7 +116,7 @@ export default defineComponent({
|
||||
return (
|
||||
<div
|
||||
role="button"
|
||||
tabindex={disabled ? undefined : 0}
|
||||
tabindex={disabled ? -1 : 0}
|
||||
class={[bem('item', { disabled }), { [HAPTICS_FEEDBACK]: !disabled }]}
|
||||
onClick={() => {
|
||||
if (!disabled) {
|
||||
|
||||
@ -173,6 +173,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div class="van-dropdown-menu">
|
||||
<div class="van-dropdown-menu__bar">
|
||||
<div role="button"
|
||||
tabindex="-1"
|
||||
class="van-dropdown-menu__item van-dropdown-menu__item--disabled"
|
||||
>
|
||||
<span class="van-dropdown-menu__title">
|
||||
@ -182,6 +183,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div role="button"
|
||||
tabindex="-1"
|
||||
class="van-dropdown-menu__item van-dropdown-menu__item--disabled"
|
||||
>
|
||||
<span class="van-dropdown-menu__title">
|
||||
|
||||
@ -380,6 +380,7 @@ exports[`disable dropdown item 1`] = `
|
||||
<div class="van-dropdown-menu">
|
||||
<div class="van-dropdown-menu__bar">
|
||||
<div role="button"
|
||||
tabindex="-1"
|
||||
class="van-dropdown-menu__item van-dropdown-menu__item--disabled"
|
||||
>
|
||||
<span class="van-dropdown-menu__title">
|
||||
|
||||
@ -271,12 +271,9 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div class="van-cell__value van-field__value">
|
||||
<div class="van-field__body">
|
||||
<div class="van-field__control van-field__control--custom">
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
@ -308,8 +305,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="false"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
|
||||
@ -71,6 +71,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-radio van-radio--disabled"
|
||||
tabindex="-1"
|
||||
aria-checked="false"
|
||||
>
|
||||
<div class="van-radio__icon van-radio__icon--round van-radio__icon--disabled">
|
||||
@ -83,6 +84,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</div>
|
||||
<div role="radio"
|
||||
class="van-radio van-radio--disabled"
|
||||
tabindex="-1"
|
||||
aria-checked="true"
|
||||
>
|
||||
<div class="van-radio__icon van-radio__icon--round van-radio__icon--disabled van-radio__icon--checked">
|
||||
|
||||
@ -195,7 +195,7 @@ export default defineComponent({
|
||||
role="radio"
|
||||
style={style}
|
||||
class={bem('item')}
|
||||
tabindex={disabled ? undefined : 0}
|
||||
tabindex={0}
|
||||
aria-setsize={+count}
|
||||
aria-posinset={score}
|
||||
aria-checked={!isVoid}
|
||||
@ -231,9 +231,7 @@ export default defineComponent({
|
||||
readonly: props.readonly,
|
||||
disabled: props.disabled,
|
||||
})}
|
||||
tabindex={props.disabled ? undefined : 0}
|
||||
aria-disabled={props.disabled}
|
||||
aria-readonly={props.readonly}
|
||||
tabindex={0}
|
||||
onTouchstart={onTouchStart}
|
||||
onTouchmove={onTouchMove}
|
||||
>
|
||||
|
||||
@ -5,8 +5,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="false"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
@ -64,8 +62,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="false"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
@ -123,8 +119,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="false"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
@ -192,8 +186,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="false"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
@ -255,8 +247,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="false"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
@ -323,11 +313,11 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div>
|
||||
<div role="radiogroup"
|
||||
class="van-rate van-rate--disabled"
|
||||
aria-disabled="true"
|
||||
aria-readonly="false"
|
||||
tabindex="0"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
tabindex="0"
|
||||
aria-setsize="5"
|
||||
aria-posinset="1"
|
||||
aria-checked="true"
|
||||
@ -337,6 +327,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</div>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
tabindex="0"
|
||||
aria-setsize="5"
|
||||
aria-posinset="2"
|
||||
aria-checked="true"
|
||||
@ -346,6 +337,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</div>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
tabindex="0"
|
||||
aria-setsize="5"
|
||||
aria-posinset="3"
|
||||
aria-checked="true"
|
||||
@ -355,6 +347,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</div>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
tabindex="0"
|
||||
aria-setsize="5"
|
||||
aria-posinset="4"
|
||||
aria-checked="false"
|
||||
@ -364,6 +357,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</div>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
tabindex="0"
|
||||
aria-setsize="5"
|
||||
aria-posinset="5"
|
||||
aria-checked="false"
|
||||
@ -377,8 +371,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate van-rate--readonly"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="true"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
@ -436,8 +428,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate van-rate--readonly"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="true"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
@ -499,8 +489,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="false"
|
||||
>
|
||||
<div role="radio"
|
||||
class="van-rate__item"
|
||||
|
||||
@ -4,8 +4,6 @@ exports[`should render gutter when using gutter prop 1`] = `
|
||||
<div role="radiogroup"
|
||||
class="van-rate"
|
||||
tabindex="0"
|
||||
aria-disabled="false"
|
||||
aria-readonly="false"
|
||||
>
|
||||
<div role="radio"
|
||||
style="padding-right: 10px;"
|
||||
|
||||
@ -294,12 +294,10 @@ export default defineComponent({
|
||||
<div
|
||||
role="slider"
|
||||
class={getButtonClassName(index)}
|
||||
tabindex={props.disabled ? undefined : 0}
|
||||
tabindex={props.disabled || props.readonly ? -1 : 0}
|
||||
aria-valuemin={+props.min}
|
||||
aria-valuenow={current}
|
||||
aria-valuemax={+props.max}
|
||||
aria-disabled={props.disabled || undefined}
|
||||
aria-readonly={props.readonly || undefined}
|
||||
aria-orientation={props.vertical ? 'vertical' : 'horizontal'}
|
||||
onTouchstart={(event) => {
|
||||
if (typeof index === 'number') {
|
||||
|
||||
@ -76,10 +76,10 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
>
|
||||
<div role="slider"
|
||||
class="van-slider__button-wrapper van-slider__button-wrapper--right"
|
||||
tabindex="-1"
|
||||
aria-valuemin="0"
|
||||
aria-valuenow="50"
|
||||
aria-valuemax="100"
|
||||
aria-disabled="true"
|
||||
aria-orientation="horizontal"
|
||||
>
|
||||
<div class="van-slider__button">
|
||||
|
||||
@ -29,27 +29,6 @@ exports[`should render left-button、right-button slot correctly 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should render readonly Slider correctly 1`] = `
|
||||
<div class="van-slider">
|
||||
<div class="van-slider__bar"
|
||||
style="width: 50%; left: 0%;"
|
||||
>
|
||||
<div role="slider"
|
||||
class="van-slider__button-wrapper van-slider__button-wrapper--right"
|
||||
tabindex="0"
|
||||
aria-valuemin="0"
|
||||
aria-valuenow="50"
|
||||
aria-valuemax="100"
|
||||
aria-readonly="true"
|
||||
aria-orientation="horizontal"
|
||||
>
|
||||
<div class="van-slider__button">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should render reversed range slider correctly 1`] = `
|
||||
<div class="van-slider">
|
||||
<div class="van-slider__bar"
|
||||
|
||||
@ -117,17 +117,6 @@ test('should not allow to click slider when readonly', async () => {
|
||||
expect(wrapper.emitted('update:modelValue')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('should render readonly Slider correctly', async () => {
|
||||
const wrapper = mount(Slider, {
|
||||
props: {
|
||||
modelValue: 50,
|
||||
readonly: true,
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should allow to drag vertical slider', () => {
|
||||
const restoreMock = mockRect(true);
|
||||
|
||||
|
||||
@ -288,7 +288,7 @@ export default defineComponent({
|
||||
useCustomFieldValue(() => props.modelValue);
|
||||
|
||||
return () => (
|
||||
<div role="group" class={bem([props.theme])}>
|
||||
<div class={bem([props.theme])}>
|
||||
<button
|
||||
v-show={props.showMinus}
|
||||
type="button"
|
||||
@ -297,7 +297,6 @@ export default defineComponent({
|
||||
bem('minus', { disabled: minusDisabled.value }),
|
||||
{ [HAPTICS_FEEDBACK]: !minusDisabled.value },
|
||||
]}
|
||||
aria-disabled={minusDisabled.value || undefined}
|
||||
{...createListeners('minus')}
|
||||
/>
|
||||
<input
|
||||
@ -329,7 +328,6 @@ export default defineComponent({
|
||||
bem('plus', { disabled: plusDisabled.value }),
|
||||
{ [HAPTICS_FEEDBACK]: !plusDisabled.value },
|
||||
]}
|
||||
aria-disabled={plusDisabled.value || undefined}
|
||||
{...createListeners('plus')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -9,12 +9,9 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-cell__value">
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
@ -39,12 +36,9 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-cell__value">
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
@ -69,12 +63,9 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-cell__value">
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
@ -99,12 +90,9 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-cell__value">
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="tel"
|
||||
@ -129,12 +117,9 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-cell__value">
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
@ -148,7 +133,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
>
|
||||
<button type="button"
|
||||
class="van-stepper__plus van-stepper__plus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
@ -161,12 +145,9 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-cell__value">
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
@ -192,12 +173,9 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-cell__value">
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
@ -222,13 +200,10 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-cell__value">
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
style="width: 32px; height: 32px;"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
@ -255,12 +230,9 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-cell__value">
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
@ -285,13 +257,10 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
<div class="van-cell__value">
|
||||
<div role="group"
|
||||
class="van-stepper van-stepper--round"
|
||||
>
|
||||
<div class="van-stepper van-stepper--round">
|
||||
<button type="button"
|
||||
style="width: 22px; height: 22px;"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`should disable buttons and input when using disabled prop 1`] = `
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
@ -20,20 +17,16 @@ exports[`should disable buttons and input when using disabled prop 1`] = `
|
||||
>
|
||||
<button type="button"
|
||||
class="van-stepper__plus van-stepper__plus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should update input height and button size when using button-size prop 1`] = `
|
||||
<div role="group"
|
||||
class="van-stepper"
|
||||
>
|
||||
<div class="van-stepper">
|
||||
<button type="button"
|
||||
style="width: 2rem; height: 2rem;"
|
||||
class="van-stepper__minus van-stepper__minus--disabled"
|
||||
aria-disabled="true"
|
||||
>
|
||||
</button>
|
||||
<input type="text"
|
||||
|
||||
@ -284,7 +284,6 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<div role="tab"
|
||||
class="van-tab van-tab--disabled"
|
||||
aria-selected="false"
|
||||
aria-disabled="true"
|
||||
>
|
||||
<span class="van-tab__text van-tab__text--ellipsis">
|
||||
Tab 2
|
||||
|
||||
@ -60,7 +60,6 @@ exports[`should allow to set name prop 1`] = `
|
||||
<div role="tab"
|
||||
class="van-tab van-tab--disabled"
|
||||
aria-selected="false"
|
||||
aria-disabled="true"
|
||||
>
|
||||
<span class="van-tab__text van-tab__text--ellipsis">
|
||||
title3
|
||||
@ -188,7 +187,6 @@ exports[`should switch tab after click the tab title 1`] = `
|
||||
<div role="tab"
|
||||
class="van-tab van-tab--disabled"
|
||||
aria-selected="false"
|
||||
aria-disabled="true"
|
||||
>
|
||||
<span class="van-tab__text van-tab__text--ellipsis">
|
||||
title3
|
||||
@ -249,7 +247,6 @@ exports[`should switch tab after click the tab title 2`] = `
|
||||
<div role="tab"
|
||||
class="van-tab van-tab--disabled"
|
||||
aria-selected="false"
|
||||
aria-disabled="true"
|
||||
>
|
||||
<span class="van-tab__text van-tab__text--ellipsis">
|
||||
title3
|
||||
@ -311,7 +308,6 @@ exports[`swipe switch tab after swiping tab content 1`] = `
|
||||
<div role="tab"
|
||||
class="van-tab van-tab--disabled"
|
||||
aria-selected="false"
|
||||
aria-disabled="true"
|
||||
>
|
||||
<span class="van-tab__text van-tab__text--ellipsis">
|
||||
title3
|
||||
@ -386,7 +382,6 @@ exports[`swipe switch tab after swiping tab content 2`] = `
|
||||
<div role="tab"
|
||||
class="van-tab van-tab--disabled"
|
||||
aria-selected="false"
|
||||
aria-disabled="true"
|
||||
>
|
||||
<span class="van-tab__text van-tab__text--ellipsis">
|
||||
title3
|
||||
@ -464,7 +459,6 @@ exports[`swipe switch tab after swiping tab content 3`] = `
|
||||
<div role="tab"
|
||||
class="van-tab van-tab--disabled"
|
||||
aria-selected="false"
|
||||
aria-disabled="true"
|
||||
>
|
||||
<span class="van-tab__text van-tab__text--ellipsis">
|
||||
title3
|
||||
|
||||
@ -85,7 +85,6 @@ export default defineComponent({
|
||||
style={style.value}
|
||||
tabindex={props.disabled ? undefined : props.isActive ? 0 : -1}
|
||||
aria-selected={props.isActive}
|
||||
aria-disabled={props.disabled || undefined}
|
||||
>
|
||||
{renderText()}
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user