mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: add Numeric type
This commit is contained in:
parent
dbad7571ac
commit
8dc8c54bca
5
packages/vant/docs/site/index.ts
Normal file
5
packages/vant/docs/site/index.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export { useTranslate, initDemoLocale } from './use-translate';
|
||||
|
||||
/** Generate the CDN URL of assets. */
|
||||
export const cdnURL = (path: string) =>
|
||||
`https://cdn.jsdelivr.net/npm/@vant/assets/${path}`;
|
@ -104,7 +104,3 @@ export function useTranslate(i18n: Record<string, any>) {
|
||||
|
||||
return createTranslate(demoName);
|
||||
}
|
||||
|
||||
/** Generate the CDN URL of assets. */
|
||||
export const cdnURL = (path: string) =>
|
||||
`https://cdn.jsdelivr.net/npm/@vant/assets/${path}`;
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanActionBar from '..';
|
||||
import VanActionBarIcon from '../../action-bar-icon';
|
||||
import VanActionBarButton from '../../action-bar-button';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanCell from '../../cell';
|
||||
import VanActionSheet, { ActionSheetAction } from '..';
|
||||
import { ref, computed } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanAddressEdit from '..';
|
||||
import { ref } from 'vue';
|
||||
import { areaList } from '@vant/area-data';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -1,7 +1,12 @@
|
||||
import { defineComponent, type PropType } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace, extend, makeRequiredProp } from '../utils';
|
||||
import {
|
||||
extend,
|
||||
createNamespace,
|
||||
makeRequiredProp,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
// Components
|
||||
import { Tag } from '../tag';
|
||||
@ -12,8 +17,8 @@ import { Radio } from '../radio';
|
||||
const [name, bem] = createNamespace('address-item');
|
||||
|
||||
export type AddressListAddress = {
|
||||
id: number | string;
|
||||
tel: number | string;
|
||||
id: Numeric;
|
||||
tel: Numeric;
|
||||
name: string;
|
||||
address: string;
|
||||
isDefault?: boolean;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanAddressList from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -3,7 +3,7 @@ import VanArea from '..';
|
||||
import { ref } from 'vue';
|
||||
import { areaList } from '@vant/area-data';
|
||||
import { areaListEn } from './area-en';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -13,6 +13,7 @@ import {
|
||||
numericProp,
|
||||
makeStringProp,
|
||||
createNamespace,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
const [name, bem] = createNamespace('badge');
|
||||
@ -28,7 +29,7 @@ const badgeProps = {
|
||||
max: numericProp,
|
||||
tag: makeStringProp<keyof HTMLElementTagNameMap>('div'),
|
||||
color: String,
|
||||
offset: Array as unknown as PropType<[string | number, string | number]>,
|
||||
offset: Array as unknown as PropType<[Numeric, Numeric]>,
|
||||
content: numericProp,
|
||||
showZero: truthProp,
|
||||
position: makeStringProp<BadgePosition>('top-right'),
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanBadge from '..';
|
||||
import VanIcon from '../../icon';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import VanButton from '..';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import VanCalendar from '..';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const minDate = new Date(2012, 0, 10);
|
||||
const maxDate = new Date(2012, 2, 20);
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanCell from '../../cell';
|
||||
import VanCalendar from '..';
|
||||
import { reactive } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import TiledDisplay from './TiledDisplay.vue';
|
||||
import type { CalendarDayItem } from '../types';
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { ComponentPublicInstance, ComputedRef, Ref } from 'vue';
|
||||
import type { Numeric } from '../utils';
|
||||
import type { CalendarProps } from './Calendar';
|
||||
import type { CalendarMonthProps } from './CalendarMonth';
|
||||
|
||||
@ -18,7 +19,7 @@ export type CalendarDayType =
|
||||
|
||||
export type CalendarDayItem = {
|
||||
date?: Date;
|
||||
text?: string | number;
|
||||
text?: Numeric;
|
||||
type?: CalendarDayType;
|
||||
topInfo?: string;
|
||||
className?: unknown;
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanCard from '..';
|
||||
import VanTag from '../../tag';
|
||||
import VanButton from '../../button';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -14,6 +14,7 @@ import {
|
||||
makeStringProp,
|
||||
createNamespace,
|
||||
HAPTICS_FEEDBACK,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
// Components
|
||||
@ -68,7 +69,7 @@ export default defineComponent({
|
||||
|
||||
const getSelectedOptionsByValue = (
|
||||
options: CascaderOption[],
|
||||
value: string | number
|
||||
value: Numeric
|
||||
): CascaderOption[] | undefined => {
|
||||
for (const option of options) {
|
||||
if (option[valueKey] === value) {
|
||||
|
@ -3,10 +3,11 @@ import VanField from '../../field';
|
||||
import VanPopup from '../../popup';
|
||||
import VanCascader, { CascaderOption } from '..';
|
||||
import { computed, reactive } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { deepClone } from '../../utils/deep-clone';
|
||||
import zhCNOptions from './area-zh-CN';
|
||||
import enUSOptions from './area-en-US';
|
||||
import type { Numeric } from '../../utils';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
@ -55,7 +56,7 @@ const t = useTranslate({
|
||||
|
||||
type StateItem = {
|
||||
show: boolean;
|
||||
value: string | number | undefined;
|
||||
value: Numeric | undefined;
|
||||
result: string;
|
||||
options?: CascaderOption[];
|
||||
tabIndex?: number;
|
||||
@ -129,7 +130,7 @@ const onFinish = (
|
||||
{
|
||||
value,
|
||||
selectedOptions,
|
||||
}: { value: number | string; selectedOptions: CascaderOption[] }
|
||||
}: { value: Numeric; selectedOptions: CascaderOption[] }
|
||||
) => {
|
||||
const result = selectedOptions
|
||||
.map((option) => option.text || option.name)
|
||||
|
@ -1,6 +1,8 @@
|
||||
import type { Numeric } from '../utils';
|
||||
|
||||
export type CascaderOption = {
|
||||
text?: string;
|
||||
value?: string | number;
|
||||
value?: Numeric;
|
||||
color?: string;
|
||||
disabled?: boolean;
|
||||
children?: CascaderOption[];
|
||||
|
@ -3,7 +3,7 @@ import VanCellGroup from '../../cell-group';
|
||||
import VanCell from '..';
|
||||
import VanTag from '../../tag';
|
||||
import VanIcon from '../../icon';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
unknownProp,
|
||||
makeStringProp,
|
||||
makeRequiredProp,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
import { Icon } from '../icon';
|
||||
|
||||
@ -16,7 +17,7 @@ export type CheckerLabelPosition = 'left' | 'right';
|
||||
export type CheckerParent = {
|
||||
props: {
|
||||
disabled?: boolean;
|
||||
iconSize?: number | string;
|
||||
iconSize?: Numeric;
|
||||
direction?: CheckerDirection;
|
||||
checkedColor?: string;
|
||||
};
|
||||
|
@ -5,7 +5,7 @@ import VanButton from '../../button';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import VanCell from '../../cell';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
import { useRefs } from '../../composables/use-refs';
|
||||
import type { CheckboxInstance } from '../types';
|
||||
import type { CheckboxGroupInstance } from '../../checkbox-group';
|
||||
|
@ -16,13 +16,14 @@ import {
|
||||
makeNumberProp,
|
||||
makeNumericProp,
|
||||
createNamespace,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
const [name, bem] = createNamespace('circle');
|
||||
|
||||
let uid = 0;
|
||||
|
||||
const format = (rate: string | number) => Math.min(Math.max(+rate, 0), 100);
|
||||
const format = (rate: Numeric) => Math.min(Math.max(+rate, 0), 100);
|
||||
|
||||
function getPath(clockwise: boolean, viewBoxSize: number) {
|
||||
const sweepFlag = clockwise ? 1 : 0;
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanCircle from '..';
|
||||
import VanButton from '../../button';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanRow from '../../row';
|
||||
import VanCol from '..';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -4,14 +4,19 @@ import {
|
||||
type InjectionKey,
|
||||
type ExtractPropTypes,
|
||||
} from 'vue';
|
||||
import { truthProp, createNamespace, BORDER_TOP_BOTTOM } from '../utils';
|
||||
import {
|
||||
truthProp,
|
||||
createNamespace,
|
||||
BORDER_TOP_BOTTOM,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
import { useChildren } from '@vant/use';
|
||||
|
||||
const [name, bem] = createNamespace('collapse');
|
||||
|
||||
export type CollapseProvide = {
|
||||
toggle: (name: number | string, expanded: boolean) => void;
|
||||
isExpanded: (name: number | string) => boolean;
|
||||
toggle: (name: Numeric, expanded: boolean) => void;
|
||||
isExpanded: (name: Numeric) => boolean;
|
||||
};
|
||||
|
||||
export const COLLAPSE_KEY: InjectionKey<CollapseProvide> = Symbol(name);
|
||||
@ -20,9 +25,7 @@ const collapseProps = {
|
||||
border: truthProp,
|
||||
accordion: Boolean,
|
||||
modelValue: {
|
||||
type: [String, Number, Array] as PropType<
|
||||
string | number | Array<string | number>
|
||||
>,
|
||||
type: [String, Number, Array] as PropType<Numeric | Numeric[]>,
|
||||
default: '',
|
||||
},
|
||||
};
|
||||
@ -30,7 +33,7 @@ const collapseProps = {
|
||||
export type CollapseProps = ExtractPropTypes<typeof collapseProps>;
|
||||
|
||||
function validateModelValue(
|
||||
modelValue: string | number | Array<string | number>,
|
||||
modelValue: Numeric | Numeric[],
|
||||
accordion: boolean
|
||||
) {
|
||||
if (accordion && Array.isArray(modelValue)) {
|
||||
@ -58,28 +61,26 @@ export default defineComponent({
|
||||
setup(props, { emit, slots }) {
|
||||
const { linkChildren } = useChildren(COLLAPSE_KEY);
|
||||
|
||||
const updateName = (name: number | string | Array<number | string>) => {
|
||||
const updateName = (name: Numeric | Numeric[]) => {
|
||||
emit('change', name);
|
||||
emit('update:modelValue', name);
|
||||
};
|
||||
|
||||
const toggle = (name: number | string, expanded: boolean) => {
|
||||
const toggle = (name: Numeric, expanded: boolean) => {
|
||||
const { accordion, modelValue } = props;
|
||||
|
||||
if (accordion) {
|
||||
updateName(name === modelValue ? '' : name);
|
||||
} else if (expanded) {
|
||||
updateName((modelValue as Array<number | string>).concat(name));
|
||||
updateName((modelValue as Numeric[]).concat(name));
|
||||
} else {
|
||||
updateName(
|
||||
(modelValue as Array<number | string>).filter(
|
||||
(activeName) => activeName !== name
|
||||
)
|
||||
(modelValue as Numeric[]).filter((activeName) => activeName !== name)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const isExpanded = (name: number | string) => {
|
||||
const isExpanded = (name: Numeric) => {
|
||||
const { accordion, modelValue } = props;
|
||||
|
||||
if (
|
||||
@ -91,7 +92,7 @@ export default defineComponent({
|
||||
|
||||
return accordion
|
||||
? modelValue === name
|
||||
: (modelValue as Array<number | string>).includes(name);
|
||||
: (modelValue as Numeric[]).includes(name);
|
||||
};
|
||||
|
||||
linkChildren({ toggle, isExpanded });
|
||||
|
@ -3,7 +3,7 @@ import VanCollapse from '..';
|
||||
import VanCollapseItem from '../../collapse-item';
|
||||
import VanIcon from '../../icon';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -7,7 +7,12 @@ import {
|
||||
type CSSProperties,
|
||||
type ExtractPropTypes,
|
||||
} from 'vue';
|
||||
import { kebabCase, makeStringProp, createNamespace } from '../utils';
|
||||
import {
|
||||
kebabCase,
|
||||
makeStringProp,
|
||||
createNamespace,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
const [name, bem] = createNamespace('config-provider');
|
||||
|
||||
@ -20,14 +25,14 @@ export const CONFIG_PROVIDER_KEY: InjectionKey<ConfigProviderProvide> =
|
||||
|
||||
const configProviderProps = {
|
||||
tag: makeStringProp<keyof HTMLElementTagNameMap>('div'),
|
||||
themeVars: Object as PropType<Record<string, string | number>>,
|
||||
themeVars: Object as PropType<Record<string, Numeric>>,
|
||||
iconPrefix: String,
|
||||
};
|
||||
|
||||
export type ConfigProviderProps = ExtractPropTypes<typeof configProviderProps>;
|
||||
|
||||
function mapThemeVarsToCSSVars(themeVars: Record<string, string | number>) {
|
||||
const cssVars: Record<string, string | number> = {};
|
||||
function mapThemeVarsToCSSVars(themeVars: Record<string, Numeric>) {
|
||||
const cssVars: Record<string, Numeric> = {};
|
||||
Object.keys(themeVars).forEach((key) => {
|
||||
cssVars[`--van-${kebabCase(key)}`] = themeVars[key];
|
||||
});
|
||||
|
@ -6,7 +6,7 @@ import VanSlider from '../../slider';
|
||||
import VanButton from '../../button';
|
||||
import VanConfigProvider from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanContactCard from '..';
|
||||
import { computed } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import VanContactEdit, { type ContactEditInfo } from '..';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { defineComponent, type PropType, type ExtractPropTypes } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace, unknownProp } from '../utils';
|
||||
import { createNamespace, unknownProp, type Numeric } from '../utils';
|
||||
|
||||
// Components
|
||||
import { Tag } from '../tag';
|
||||
@ -14,8 +14,8 @@ import { RadioGroup } from '../radio-group';
|
||||
const [name, bem, t] = createNamespace('contact-list');
|
||||
|
||||
export type ContactListItem = {
|
||||
id?: number | string;
|
||||
tel: number | string;
|
||||
id?: Numeric;
|
||||
tel: Numeric;
|
||||
name: string;
|
||||
isDefault?: boolean;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanContactList from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -3,7 +3,7 @@ import VanGrid from '../../grid';
|
||||
import VanGridItem from '../../grid-item';
|
||||
import VanCountDown, { type CountDownInstance } from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -3,7 +3,7 @@ import VanCouponCell from '../../coupon-cell';
|
||||
import VanPopup from '../../popup';
|
||||
import VanCouponList from '..';
|
||||
import { ref, computed } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { CouponInfo } from '../../coupon';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { later, mount } from '../../../test';
|
||||
import { CouponList } from '..';
|
||||
import { cdnURL } from '../../../docs/site/use-translate';
|
||||
import { cdnURL } from '../../../docs/site';
|
||||
|
||||
const coupon = {
|
||||
id: 1,
|
||||
|
@ -1,10 +1,15 @@
|
||||
import { computed, defineComponent, type PropType } from 'vue';
|
||||
import { makeStringProp, createNamespace, makeRequiredProp } from '../utils';
|
||||
import {
|
||||
makeStringProp,
|
||||
createNamespace,
|
||||
makeRequiredProp,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
import { getDate, formatAmount, formatDiscount } from './utils';
|
||||
import { Checkbox } from '../checkbox';
|
||||
|
||||
export type CouponInfo = {
|
||||
id: string | number;
|
||||
id: Numeric;
|
||||
name: string;
|
||||
endAt: number;
|
||||
value: number;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanDatetimePicker from '..';
|
||||
import { reactive } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanCell from '../../cell';
|
||||
import { Dialog } from '..';
|
||||
import { ref } from 'vue';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
import type { DialogAction } from '../types';
|
||||
|
||||
const VanDialog = Dialog.Component;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Dialog } from './function-call';
|
||||
import type { CSSProperties, TeleportProps } from 'vue';
|
||||
import type { Interceptor } from '../utils';
|
||||
import type { Interceptor, Numeric } from '../utils';
|
||||
|
||||
export type DialogTheme = 'default' | 'round-button';
|
||||
export type DialogAction = 'confirm' | 'cancel';
|
||||
@ -9,7 +9,7 @@ export type DialogMessageAlign = 'left' | 'center' | 'right';
|
||||
|
||||
export type DialogOptions = {
|
||||
title?: string;
|
||||
width?: string | number;
|
||||
width?: Numeric;
|
||||
theme?: DialogTheme;
|
||||
message?: DialogMessage;
|
||||
overlay?: boolean;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import VanDivider from '..';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,10 +1,11 @@
|
||||
import type { DropdownItemProps } from './DropdownItem';
|
||||
import type { VNode, ComponentPublicInstance } from 'vue';
|
||||
import type { Numeric } from '../utils';
|
||||
|
||||
export type DropdownItemOption = {
|
||||
text: string;
|
||||
icon?: string;
|
||||
value: number | string;
|
||||
value: Numeric;
|
||||
};
|
||||
|
||||
export type DropdownItemExpose = {
|
||||
|
@ -5,7 +5,7 @@ import VanCell from '../../cell';
|
||||
import VanSwitch from '../../switch';
|
||||
import VanButton from '../../button';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import type { DropdownItemInstance } from '../../dropdown-item';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -4,7 +4,7 @@ import VanTabs from '../../tabs';
|
||||
import VanTab from '../../tab';
|
||||
import VanButton from '../../button';
|
||||
import { ref } from 'vue';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanField from '..';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanField from '..';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanField from '..';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanField from '..';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanField from '..';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanField from '..';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanField from '..';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -3,7 +3,7 @@ import VanField from '..';
|
||||
import VanButton from '../../button';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanField from '..';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanField from '..';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -4,7 +4,7 @@ import VanField from '../../field';
|
||||
import VanButton from '../../button';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { FieldValidateError } from '../../field/types';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
import VanForm from '..';
|
||||
import VanRate from '../../rate';
|
||||
import VanRadio from '../../radio';
|
||||
|
@ -4,7 +4,7 @@ import VanField from '../../field';
|
||||
import VanPopup from '../../popup';
|
||||
import { ref } from 'vue';
|
||||
import { areaList } from '@vant/area-data';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { areaListEn } from '../../area/demo/area-en';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanField from '../../field';
|
||||
import VanCalendar from '../../calendar';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -3,7 +3,7 @@ import VanField from '../../field';
|
||||
import VanPopup from '../../popup';
|
||||
import VanDatetimePicker from '../../datetime-picker';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -3,7 +3,7 @@ import VanField from '../../field';
|
||||
import VanPopup from '../../popup';
|
||||
import VanPicker from '../../picker';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -4,7 +4,7 @@ import VanField from '../../field';
|
||||
import VanButton from '../../button';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { FieldValidateError } from '../../field/types';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanGrid from '..';
|
||||
import VanGridItem from '../../grid-item';
|
||||
import VanImage from '../../image';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -6,7 +6,7 @@ import VanRow from '../../row';
|
||||
import VanCol from '../../col';
|
||||
import icons from '@vant/icons';
|
||||
import { ref } from 'vue';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
import { Notify } from '../../notify';
|
||||
|
||||
// from https://30secondsofcode.org
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Icon } from '..';
|
||||
import { mount } from '../../../test';
|
||||
import { cdnURL } from '../../../docs/site/use-translate';
|
||||
import { cdnURL } from '../../../docs/site';
|
||||
|
||||
test('should render icon with builtin icon name correctly', () => {
|
||||
const wrapper = mount(Icon, {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanCell from '../../cell';
|
||||
import { ImagePreview, ImagePreviewOptions } from '..';
|
||||
import { ref } from 'vue';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const VanImagePreview = ImagePreview.Component;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { DOMWrapper } from '@vue/test-utils/dist/domWrapper';
|
||||
import { cdnURL } from '../../../docs/site/use-translate';
|
||||
import { cdnURL } from '../../../docs/site';
|
||||
import { trigger } from '../../../test';
|
||||
|
||||
export const images = [
|
||||
|
@ -3,7 +3,7 @@ import VanRow from '../../row';
|
||||
import VanImage from '..';
|
||||
import VanCol from '../../col';
|
||||
import VanLoading from '../../loading';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -25,6 +25,7 @@ import {
|
||||
createNamespace,
|
||||
getRootScrollTop,
|
||||
setRootScrollTop,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
// Composables
|
||||
@ -58,7 +59,7 @@ const indexBarProps = {
|
||||
highlightColor: String,
|
||||
stickyOffsetTop: makeNumberProp(0),
|
||||
indexList: {
|
||||
type: Array as PropType<Array<string | number>>,
|
||||
type: Array as PropType<Numeric[]>,
|
||||
default: genAlphabet,
|
||||
},
|
||||
};
|
||||
@ -76,7 +77,7 @@ export default defineComponent({
|
||||
|
||||
setup(props, { emit, slots }) {
|
||||
const root = ref<HTMLElement>();
|
||||
const activeAnchor = ref<string | number>('');
|
||||
const activeAnchor = ref<Numeric>('');
|
||||
|
||||
const touch = useTouch();
|
||||
const scrollParent = useScrollParent(root);
|
||||
@ -207,7 +208,7 @@ export default defineComponent({
|
||||
);
|
||||
});
|
||||
|
||||
const scrollTo = (index: string | number) => {
|
||||
const scrollTo = (index: Numeric) => {
|
||||
selectActiveIndex = String(index);
|
||||
const match = getMatchAnchor(selectActiveIndex);
|
||||
|
||||
|
@ -5,7 +5,7 @@ import VanIndexBar from '..';
|
||||
import VanIndexAnchor from '../../index-anchor';
|
||||
import VanCell from '../../cell';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { ComponentPublicInstance } from 'vue';
|
||||
import type { Numeric } from '../utils';
|
||||
import type { IndexBarProps } from './IndexBar';
|
||||
|
||||
export type IndexBarProvide = {
|
||||
@ -6,7 +7,7 @@ export type IndexBarProvide = {
|
||||
};
|
||||
|
||||
export type IndexBarExpose = {
|
||||
scrollTo: (index: string | number) => void;
|
||||
scrollTo: (index: Numeric) => void;
|
||||
};
|
||||
|
||||
export type IndexBarInstance = ComponentPublicInstance<
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import Lazyload from '..';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
|
||||
if (window.app) {
|
||||
window.app.use(Lazyload, { lazyComponent: true });
|
||||
|
@ -5,7 +5,7 @@ import VanList from '..';
|
||||
import VanCell from '../../cell';
|
||||
import VanPullRefresh from '../../pull-refresh';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import VanLoading from '..';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanNavBar from '..';
|
||||
import VanIcon from '../../icon';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanNoticeBar from '..';
|
||||
import VanSwipe from '../../swipe';
|
||||
import VanSwipeItem from '../../swipe-item';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -3,7 +3,7 @@ import VanCell from '../../cell';
|
||||
import VanIcon from '../../icon';
|
||||
import { ref } from 'vue';
|
||||
import { Notify, type NotifyType } from '..';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const VanNotify = Notify.Component;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Notify } from './function-call';
|
||||
import type { Numeric } from '../utils';
|
||||
|
||||
export type NotifyMessage = string | number;
|
||||
export type NotifyMessage = Numeric;
|
||||
|
||||
export type NotifyType = 'primary' | 'success' | 'danger' | 'warning';
|
||||
|
||||
|
@ -21,6 +21,7 @@ import {
|
||||
stopPropagation,
|
||||
createNamespace,
|
||||
HAPTICS_FEEDBACK,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
// Composables
|
||||
@ -34,7 +35,7 @@ const [name, bem] = createNamespace('number-keyboard');
|
||||
export type NumberKeyboardTheme = 'default' | 'custom';
|
||||
|
||||
type KeyConfig = {
|
||||
text?: number | string;
|
||||
text?: Numeric;
|
||||
type?: KeyType;
|
||||
color?: string;
|
||||
wider?: boolean;
|
||||
|
@ -3,7 +3,7 @@ import VanCell from '../../cell';
|
||||
import VanField from '../../field';
|
||||
import VanNumberKeyboard from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanButton from '../../button';
|
||||
import VanOverlay from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -11,19 +11,20 @@ import {
|
||||
makeNumericProp,
|
||||
createNamespace,
|
||||
BORDER_SURROUND,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
const [name, bem, t] = createNamespace('pagination');
|
||||
|
||||
type PageItem = {
|
||||
text: string | number;
|
||||
text: Numeric;
|
||||
number: number;
|
||||
active?: boolean;
|
||||
};
|
||||
|
||||
const makePage = (
|
||||
number: number,
|
||||
text: string | number,
|
||||
text: Numeric,
|
||||
active?: boolean
|
||||
): PageItem => ({ number, text, active });
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanPagination from '..';
|
||||
import VanIcon from '../../icon';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -3,7 +3,7 @@ import VanPasswordInput from '..';
|
||||
import VanNumberKeyboard from '../../number-keyboard';
|
||||
import { ref, watch } from 'vue';
|
||||
import { ComponentInstance } from '../../utils';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -4,7 +4,7 @@ import VanField from '../../field';
|
||||
import VanPopup from '../../popup';
|
||||
import { ref, computed } from 'vue';
|
||||
import { dateColumns, cascadeColumns, cascadeColumnsCustomKey } from './data';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* eslint-disable no-use-before-define */
|
||||
import type { ComponentPublicInstance } from 'vue';
|
||||
import type { Numeric } from '../utils';
|
||||
import type { PickerProps } from './Picker';
|
||||
|
||||
export type PickerToolbarPosition = 'top' | 'bottom';
|
||||
@ -11,13 +12,13 @@ export type PickerFieldNames = {
|
||||
};
|
||||
|
||||
export type PickerObjectOption = {
|
||||
text?: string | number;
|
||||
text?: Numeric;
|
||||
disabled?: boolean;
|
||||
// for custom filed names
|
||||
[key: PropertyKey]: any;
|
||||
};
|
||||
|
||||
export type PickerOption = string | number | PickerObjectOption;
|
||||
export type PickerOption = Numeric | PickerObjectOption;
|
||||
|
||||
export type PickerObjectColumn = {
|
||||
values?: PickerOption[];
|
||||
|
@ -8,7 +8,7 @@ import VanPicker from '../../picker';
|
||||
import VanGrid from '../../grid';
|
||||
import VanGridItem from '../../grid-item';
|
||||
import { Toast } from '../../toast';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanCell from '../../cell';
|
||||
import VanPopup from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,5 +1,11 @@
|
||||
import { computed, defineComponent, type ExtractPropTypes } from 'vue';
|
||||
import { addUnit, truthProp, numericProp, createNamespace } from '../utils';
|
||||
import {
|
||||
addUnit,
|
||||
truthProp,
|
||||
numericProp,
|
||||
createNamespace,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
const [name, bem] = createNamespace('progress');
|
||||
|
||||
@ -15,7 +21,7 @@ const progressProps = {
|
||||
percentage: {
|
||||
type: numericProp,
|
||||
default: 0,
|
||||
validator: (value: number | string) => value >= 0 && value <= 100,
|
||||
validator: (value: Numeric) => value >= 0 && value <= 100,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanProgress from '..';
|
||||
import VanButton from '../../button';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -3,7 +3,7 @@ import VanTabs from '../../tabs';
|
||||
import VanTab from '../../tab';
|
||||
import VanPullRefresh from '..';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -4,7 +4,7 @@ import VanRadio from '..';
|
||||
import VanCellGroup from '../../cell-group';
|
||||
import VanCell from '../../cell';
|
||||
import { ref } from 'vue';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanRate from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanSearch from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanCell from '../../cell';
|
||||
import VanShareSheet, { ShareSheetOption, ShareSheetOptions } from '..';
|
||||
import { ref, computed } from 'vue';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -4,7 +4,7 @@ import VanGridItem from '../../grid-item';
|
||||
import VanSidebar from '..';
|
||||
import VanSidebarItem from '../../sidebar-item';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
makeStringProp,
|
||||
makeNumericProp,
|
||||
createNamespace,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
const [name, bem] = createNamespace('skeleton');
|
||||
@ -26,9 +27,7 @@ const skeletonProps = {
|
||||
titleWidth: numericProp,
|
||||
avatarShape: makeStringProp<SkeletonAvatarShape>('round'),
|
||||
rowWidth: {
|
||||
type: [Number, String, Array] as PropType<
|
||||
number | string | (number | string)[]
|
||||
>,
|
||||
type: [Number, String, Array] as PropType<Numeric | Numeric[]>,
|
||||
default: DEFAULT_ROW_WIDTH,
|
||||
},
|
||||
};
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanSkeleton from '..';
|
||||
import VanSwitch from '../../switch';
|
||||
import { ref } from 'vue';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site/use-translate';
|
||||
import { cdnURL, useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import VanSlider from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -24,6 +24,7 @@ import {
|
||||
callInterceptor,
|
||||
makeNumericProp,
|
||||
HAPTICS_FEEDBACK,
|
||||
type Numeric,
|
||||
} from '../utils';
|
||||
|
||||
// Composables
|
||||
@ -34,7 +35,7 @@ const [name, bem] = createNamespace('stepper');
|
||||
const LONG_PRESS_INTERVAL = 200;
|
||||
const LONG_PRESS_START_TIME = 600;
|
||||
|
||||
const isEqual = (value1?: string | number, value2?: string | number) =>
|
||||
const isEqual = (value1?: Numeric, value2?: Numeric) =>
|
||||
String(value1) === String(value2);
|
||||
|
||||
export type StepperTheme = 'default' | 'round';
|
||||
@ -82,7 +83,7 @@ export default defineComponent({
|
||||
],
|
||||
|
||||
setup(props, { emit }) {
|
||||
const format = (value: string | number) => {
|
||||
const format = (value: Numeric) => {
|
||||
const { min, max, allowEmpty, decimalLength } = props;
|
||||
|
||||
if (allowEmpty && value === '') {
|
||||
@ -139,7 +140,7 @@ export default defineComponent({
|
||||
}
|
||||
};
|
||||
|
||||
const setValue = (value: string | number) => {
|
||||
const setValue = (value: Numeric) => {
|
||||
if (props.beforeChange) {
|
||||
callInterceptor(props.beforeChange, {
|
||||
args: [value],
|
||||
|
@ -2,7 +2,7 @@
|
||||
import VanCell from '../../cell';
|
||||
import VanStepper from '..';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
import { Toast } from '../../toast';
|
||||
|
||||
const t = useTranslate({
|
||||
|
@ -3,7 +3,7 @@ import VanSteps from '..';
|
||||
import VanStep from '../../step';
|
||||
import VanButton from '../../button';
|
||||
import { ref } from 'vue';
|
||||
import { useTranslate } from '../../../docs/site/use-translate';
|
||||
import { useTranslate } from '../../../docs/site';
|
||||
|
||||
const t = useTranslate({
|
||||
'zh-CN': {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user