mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-07-15 10:01:06 +08:00
Compare commits
6 Commits
70eec20d25
...
0fc3361226
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fc3361226 | ||
|
|
6ff2b7ff0e | ||
|
|
03988a0d32 | ||
|
|
4f64457aa0 | ||
|
|
70c4ddf46e | ||
|
|
a3380f08c0 |
71
packages/vant/docs/markdown/faq.zh-CN.md
Normal file
71
packages/vant/docs/markdown/faq.zh-CN.md
Normal file
@ -0,0 +1,71 @@
|
||||
# 常见问题
|
||||
|
||||
### 如何自定义 Vant 组件的样式?
|
||||
|
||||
#### 1. 主题定制
|
||||
|
||||
Vant 基于 CSS 变量提供了主题定制的能力,可以对组件样式进行统一修改,详见 [ConfigProvider 全局配置](#/zh-CN/config-provider) 组件。
|
||||
|
||||
#### 2. 覆盖默认样式
|
||||
|
||||
如果主题定制不能满足你的需求,也可以通过**自定义样式类**来覆盖默认样式,参考下面的示例:
|
||||
|
||||
```html
|
||||
<template>
|
||||
<van-button class="my-button">按钮</van-button>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
/** 覆盖 Button 最外层元素的样式 */
|
||||
.my-button {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
/** 覆盖 Button 内部子元素的样式 */
|
||||
.my-button .van-button__text {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
### 在 HTML 中无法正确渲染组件?
|
||||
|
||||
在 HTML 中使用 Vant 组件时,你可能会碰到部分示例代码无法正确渲染的情况,比如下面的用法:
|
||||
|
||||
```html
|
||||
<van-cell-group>
|
||||
<van-cell title="单元格" value="内容" />
|
||||
<van-cell title="单元格" value="内容" />
|
||||
</van-cell-group>
|
||||
```
|
||||
|
||||
这是因为 HTML 并不支持自闭合的自定义元素,也就是说 `<van-cell />` 这样的语法是不被识别的,使用完整的闭合标签可以避免这个问题:
|
||||
|
||||
```html
|
||||
<van-cell-group>
|
||||
<van-cell title="单元格" value="内容"></van-cell>
|
||||
<van-cell title="单元格" value="内容"></van-cell>
|
||||
</van-cell-group>
|
||||
```
|
||||
|
||||
在单文件组件、字符串模板和 JSX 中可以使用自闭合的自定义元素,因此不会出现这个问题。
|
||||
|
||||
### 在 iOS 上点击组件时,无法触发点击反馈效果?
|
||||
|
||||
这是因为 iOS Safari 默认不会触发 `:active` 伪类,解决方法是在 `body` 标签上添加一个空的 `ontouchstart` 属性:
|
||||
|
||||
```html
|
||||
<body ontouchstart="">
|
||||
...
|
||||
</body>
|
||||
```
|
||||
|
||||
参考链接:[stackoverflow - :active pseudo-class doesn't work in mobile safari](https://stackoverflow.com/questions/3885018/active-pseudo-class-doesnt-work-in-mobile-safari/33681490#33681490)
|
||||
|
||||
### 部分组件无法在桌面端进行操作?
|
||||
|
||||
参见[桌面端适配](#/zh-CN/advanced-usage#zhuo-mian-duan-gua-pei)。
|
||||
|
||||
### 如何进行移动端响应式适配?
|
||||
|
||||
参见[浏览器适配](#/zh-CN/advanced-usage#liu-lan-qi-gua-pei)。
|
||||
@ -186,55 +186,3 @@ app.use(Vant);
|
||||
```
|
||||
|
||||
> Tips: 配置按需引入后,将不允许直接导入所有组件。
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 如何自定义 Vant 组件的样式?
|
||||
|
||||
#### 1. 主题定制
|
||||
|
||||
Vant 基于 CSS 变量提供了主题定制的能力,可以对组件样式进行统一修改,详见 [ConfigProvider 全局配置](#/zh-CN/config-provider) 组件。
|
||||
|
||||
#### 2. 覆盖默认样式
|
||||
|
||||
如果主题定制不能满足你的需求,也可以通过**自定义样式类**来覆盖默认样式,参考下面的示例:
|
||||
|
||||
```html
|
||||
<template>
|
||||
<van-button class="my-button">按钮</van-button>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
/** 覆盖 Button 最外层元素的样式 */
|
||||
.my-button {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
/** 覆盖 Button 内部子元素的样式 */
|
||||
.my-button .van-button__text {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
### 在 HTML 中无法正确渲染组件?
|
||||
|
||||
在 HTML 中使用 Vant 组件时,你可能会碰到部分示例代码无法正确渲染的情况,比如下面的用法:
|
||||
|
||||
```html
|
||||
<van-cell-group>
|
||||
<van-cell title="单元格" value="内容" />
|
||||
<van-cell title="单元格" value="内容" />
|
||||
</van-cell-group>
|
||||
```
|
||||
|
||||
这是因为 HTML 并不支持自闭合的自定义元素,也就是说 `<van-cell />` 这样的语法是不被识别的,使用完整的闭合标签可以避免这个问题:
|
||||
|
||||
```html
|
||||
<van-cell-group>
|
||||
<van-cell title="单元格" value="内容"></van-cell>
|
||||
<van-cell title="单元格" value="内容"></van-cell>
|
||||
</van-cell-group>
|
||||
```
|
||||
|
||||
在单文件组件、字符串模板和 JSX 中可以使用自闭合的自定义元素,因此不会出现这个问题。
|
||||
|
||||
@ -133,6 +133,7 @@ The component exports the following type definitions:
|
||||
```ts
|
||||
import type {
|
||||
AddressEditInfo,
|
||||
AddressEditProps,
|
||||
AddressEditInstance,
|
||||
AddressEditSearchItem,
|
||||
} from 'vant';
|
||||
|
||||
@ -133,6 +133,7 @@ export default {
|
||||
```ts
|
||||
import type {
|
||||
AddressEditInfo,
|
||||
AddressEditProps,
|
||||
AddressEditInstance,
|
||||
AddressEditSearchItem,
|
||||
} from 'vant';
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _AddressEdit from './AddressEdit';
|
||||
import _AddressEdit, { AddressEditProps } from './AddressEdit';
|
||||
|
||||
export const AddressEdit = withInstall(_AddressEdit);
|
||||
export default AddressEdit;
|
||||
export type { AddressEditProps };
|
||||
export type {
|
||||
AddressEditInfo,
|
||||
AddressEditInstance,
|
||||
|
||||
@ -169,7 +169,7 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get Area i
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { AreaList, AreaInstance, AreaColumnOption } from 'vant';
|
||||
import type { AreaProps, AreaList, AreaInstance, AreaColumnOption } from 'vant';
|
||||
```
|
||||
|
||||
`AreaInstance` is the type of component instance:
|
||||
|
||||
@ -171,7 +171,7 @@ confirm 事件返回的数据整体为一个数组,数组每一项对应一列
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { AreaList, AreaInstance, AreaColumnOption } from 'vant';
|
||||
import type { AreaProps, AreaList, AreaInstance, AreaColumnOption } from 'vant';
|
||||
```
|
||||
|
||||
`AreaInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Area from './Area';
|
||||
import _Area, { AreaProps } from './Area';
|
||||
|
||||
export const Area = withInstall(_Area);
|
||||
export default Area;
|
||||
export type { AreaProps };
|
||||
export type { AreaList, AreaInstance, AreaColumnOption } from './types';
|
||||
|
||||
@ -354,6 +354,7 @@ The component exports the following type definitions:
|
||||
```ts
|
||||
import type {
|
||||
CalendarType,
|
||||
CalendarProps,
|
||||
CalendarDayItem,
|
||||
CalendarDayType,
|
||||
CalendarInstance,
|
||||
|
||||
@ -360,6 +360,7 @@ export default {
|
||||
```ts
|
||||
import type {
|
||||
CalendarType,
|
||||
CalendarProps,
|
||||
CalendarDayItem,
|
||||
CalendarDayType,
|
||||
CalendarInstance,
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Calendar from './Calendar';
|
||||
import _Calendar, { CalendarProps } from './Calendar';
|
||||
|
||||
export const Calendar = withInstall(_Calendar);
|
||||
export default Calendar;
|
||||
export type { CalendarProps };
|
||||
export type {
|
||||
CalendarType,
|
||||
CalendarDayItem,
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _CheckboxGroup from './CheckboxGroup';
|
||||
import _CheckboxGroup, { CheckboxGroupProps } from './CheckboxGroup';
|
||||
|
||||
export const CheckboxGroup = withInstall(_CheckboxGroup);
|
||||
export default CheckboxGroup;
|
||||
export type { CheckboxGroupProps };
|
||||
export type {
|
||||
CheckboxGroupInstance,
|
||||
CheckboxGroupToggleAllOptions,
|
||||
|
||||
@ -333,7 +333,9 @@ The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type {
|
||||
CheckboxProps,
|
||||
CheckboxInstance,
|
||||
CheckboxGroupProps,
|
||||
CheckboxGroupInstance,
|
||||
CheckboxGroupToggleAllOptions,
|
||||
} from 'vant';
|
||||
|
||||
@ -351,7 +351,9 @@ checkboxGroup.toggleAll({
|
||||
|
||||
```ts
|
||||
import type {
|
||||
CheckboxProps,
|
||||
CheckboxInstance,
|
||||
CheckboxGroupProps,
|
||||
CheckboxGroupInstance,
|
||||
CheckboxGroupToggleAllOptions,
|
||||
} from 'vant';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Checkbox from './Checkbox';
|
||||
import _Checkbox, { CheckboxProps } from './Checkbox';
|
||||
|
||||
export const Checkbox = withInstall(_Checkbox);
|
||||
export default Checkbox;
|
||||
export type { CheckboxProps };
|
||||
export type { CheckboxInstance } from './types';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _CollapseItem from './CollapseItem';
|
||||
import _CollapseItem, { CollapseItemProps } from './CollapseItem';
|
||||
|
||||
export const CollapseItem = withInstall(_CollapseItem);
|
||||
export default CollapseItem;
|
||||
export type { CollapseItemProps };
|
||||
export type { CollapseItemInstance } from './types';
|
||||
|
||||
@ -155,7 +155,7 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get Collap
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { CollapseItemInstance } from 'vant';
|
||||
import type { CollapseItemProps, CollapseItemInstance } from 'vant';
|
||||
```
|
||||
|
||||
`CollapseItemInstance` is the type of component instance:
|
||||
|
||||
@ -153,7 +153,7 @@ export default {
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { CollapseItemInstance } from 'vant';
|
||||
import type { CollapseItemProps, CollapseItemInstance } from 'vant';
|
||||
```
|
||||
|
||||
`CollapseItemInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,17 +1,11 @@
|
||||
import {
|
||||
watch,
|
||||
computed,
|
||||
defineComponent,
|
||||
ExtractPropTypes,
|
||||
ComponentPublicInstance,
|
||||
} from 'vue';
|
||||
import { watch, computed, defineComponent, ExtractPropTypes } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { truthProp, createNamespace } from '../utils';
|
||||
import { parseFormat } from './utils';
|
||||
|
||||
// Composables
|
||||
import { useCountDown, CurrentTime } from '@vant/use';
|
||||
import { useCountDown } from '@vant/use';
|
||||
import { useExpose } from '../composables/use-expose';
|
||||
|
||||
const [name, bem] = createNamespace('count-down');
|
||||
@ -29,20 +23,7 @@ const props = {
|
||||
},
|
||||
};
|
||||
|
||||
type CountDownProps = ExtractPropTypes<typeof props>;
|
||||
|
||||
type CountDownExpose = {
|
||||
start: () => void;
|
||||
pause: () => void;
|
||||
reset: () => void;
|
||||
};
|
||||
|
||||
export type CountDownInstance = ComponentPublicInstance<
|
||||
CountDownProps,
|
||||
CountDownExpose
|
||||
>;
|
||||
|
||||
export type CountDownCurrentTime = CurrentTime;
|
||||
export type CountDownProps = ExtractPropTypes<typeof props>;
|
||||
|
||||
export default defineComponent({
|
||||
name,
|
||||
|
||||
@ -186,7 +186,11 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get CountD
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { CountDownInstance, CountDownCurrentTime } from 'vant';
|
||||
import type {
|
||||
CountDownProps,
|
||||
CountDownInstance,
|
||||
CountDownCurrentTime,
|
||||
} from 'vant';
|
||||
```
|
||||
|
||||
`CountDownInstance` is the type of component instance:
|
||||
|
||||
@ -196,7 +196,11 @@ export default {
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { CountDownInstance, CountDownCurrentTime } from 'vant';
|
||||
import type {
|
||||
CountDownProps,
|
||||
CountDownInstance,
|
||||
CountDownCurrentTime,
|
||||
} from 'vant';
|
||||
```
|
||||
|
||||
`CountDownInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _CountDown from './CountDown';
|
||||
import _CountDown, { CountDownProps } from './CountDown';
|
||||
|
||||
export const CountDown = withInstall(_CountDown);
|
||||
export default CountDown;
|
||||
export type { CountDownInstance, CountDownCurrentTime } from './CountDown';
|
||||
export type { CountDownProps };
|
||||
export type { CountDownInstance, CountDownCurrentTime } from './types';
|
||||
|
||||
16
packages/vant/src/count-down/types.ts
Normal file
16
packages/vant/src/count-down/types.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import type { ComponentPublicInstance } from 'vue';
|
||||
import type { CurrentTime } from '@vant/use';
|
||||
import type { CountDownProps } from './CountDown';
|
||||
|
||||
type CountDownExpose = {
|
||||
start: () => void;
|
||||
pause: () => void;
|
||||
reset: () => void;
|
||||
};
|
||||
|
||||
export type CountDownInstance = ComponentPublicInstance<
|
||||
CountDownProps,
|
||||
CountDownExpose
|
||||
>;
|
||||
|
||||
export type CountDownCurrentTime = CurrentTime;
|
||||
@ -348,7 +348,11 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get Dateti
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { DatetimePickerType, DatetimePickerInstance } from 'vant';
|
||||
import type {
|
||||
DatetimePickerType,
|
||||
DatetimePickerProps,
|
||||
DatetimePickerInstance,
|
||||
} from 'vant';
|
||||
```
|
||||
|
||||
`DatetimePickerInstance` is the type of component instance:
|
||||
|
||||
@ -357,7 +357,11 @@ export default {
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { DatetimePickerType, DatetimePickerInstance } from 'vant';
|
||||
import type {
|
||||
DatetimePickerType,
|
||||
DatetimePickerProps,
|
||||
DatetimePickerInstance,
|
||||
} from 'vant';
|
||||
```
|
||||
|
||||
`DatetimePickerInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _DatetimePicker from './DatetimePicker';
|
||||
import _DatetimePicker, { DatetimePickerProps } from './DatetimePicker';
|
||||
|
||||
export const DatetimePicker = withInstall(_DatetimePicker);
|
||||
export default DatetimePicker;
|
||||
export type { DatetimePickerProps };
|
||||
export type { DatetimePickerType, DatetimePickerInstance } from './types';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _DropdownItem from './DropdownItem';
|
||||
import _DropdownItem, { DropdownItemProps } from './DropdownItem';
|
||||
|
||||
export const DropdownItem = withInstall(_DropdownItem);
|
||||
export default DropdownItem;
|
||||
export type { DropdownItemProps };
|
||||
export type { DropdownItemInstance, DropdownItemOption } from './types';
|
||||
|
||||
@ -197,6 +197,8 @@ The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type {
|
||||
DropdownMenuProps,
|
||||
DropdownItemProps,
|
||||
DropdownItemOption,
|
||||
DropdownItemInstance,
|
||||
DropdownMenuDirection,
|
||||
|
||||
@ -201,6 +201,8 @@ export default {
|
||||
|
||||
```ts
|
||||
import type {
|
||||
DropdownMenuProps,
|
||||
DropdownItemProps,
|
||||
DropdownItemOption,
|
||||
DropdownItemInstance,
|
||||
DropdownMenuDirection,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _DropdownMenu from './DropdownMenu';
|
||||
import _DropdownMenu, { DropdownMenuProps } from './DropdownMenu';
|
||||
|
||||
export const DropdownMenu = withInstall(_DropdownMenu);
|
||||
export default DropdownMenu;
|
||||
export type { DropdownMenuProps };
|
||||
export type { DropdownMenuDirection } from './types';
|
||||
|
||||
@ -69,6 +69,7 @@ export const fieldSharedProps = {
|
||||
maxlength: [Number, String],
|
||||
inputAlign: String as PropType<FieldTextAlign>,
|
||||
placeholder: String,
|
||||
autocomplete: String,
|
||||
errorMessage: String,
|
||||
error: {
|
||||
type: Boolean,
|
||||
@ -108,7 +109,6 @@ const props = extend({}, cellProps, fieldSharedProps, {
|
||||
labelWidth: [Number, String],
|
||||
labelClass: unknownProp,
|
||||
labelAlign: String as PropType<FieldTextAlign>,
|
||||
autocomplete: String,
|
||||
showWordLimit: Boolean,
|
||||
errorMessageAlign: String as PropType<FieldTextAlign>,
|
||||
type: {
|
||||
|
||||
@ -315,6 +315,7 @@ The component exports the following type definitions:
|
||||
import type {
|
||||
FieldType,
|
||||
FieldRule,
|
||||
FieldProps,
|
||||
FieldInstance,
|
||||
FieldTextAlign,
|
||||
FieldClearTrigger,
|
||||
|
||||
@ -334,6 +334,7 @@ export default {
|
||||
import type {
|
||||
FieldType,
|
||||
FieldRule,
|
||||
FieldProps,
|
||||
FieldInstance,
|
||||
FieldTextAlign,
|
||||
FieldClearTrigger,
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Field from './Field';
|
||||
import _Field, { FieldProps } from './Field';
|
||||
|
||||
export const Field = withInstall(_Field);
|
||||
export default Field;
|
||||
export type { FieldProps };
|
||||
export type {
|
||||
FieldType,
|
||||
FieldRule,
|
||||
|
||||
@ -547,7 +547,7 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get Form i
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { FormInstance } from 'vant';
|
||||
import type { FormProps, FormInstance } from 'vant';
|
||||
```
|
||||
|
||||
`FormInstance` is the type of component instance:
|
||||
|
||||
@ -585,7 +585,7 @@ export default {
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { FormInstance } from 'vant';
|
||||
import type { FormProps, FormInstance } from 'vant';
|
||||
```
|
||||
|
||||
`FormInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Form from './Form';
|
||||
import _Form, { FormProps } from './Form';
|
||||
|
||||
export const Form = withInstall(_Form);
|
||||
export default Form;
|
||||
export type { FormProps };
|
||||
export type { FormInstance } from './types';
|
||||
|
||||
@ -191,6 +191,7 @@ The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type {
|
||||
ImagePreviewProps,
|
||||
ImagePreviewOptions,
|
||||
ImagePreviewInstance,
|
||||
ImagePreviewScaleEventParams,
|
||||
|
||||
@ -241,6 +241,7 @@ export default {
|
||||
|
||||
```ts
|
||||
import type {
|
||||
ImagePreviewProps,
|
||||
ImagePreviewOptions,
|
||||
ImagePreviewInstance,
|
||||
ImagePreviewScaleEventParams,
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { ImagePreview } from './function-call';
|
||||
import type { ImagePreviewProps } from './ImagePreview';
|
||||
|
||||
export default ImagePreview;
|
||||
export { ImagePreview };
|
||||
export type { ImagePreviewProps };
|
||||
export type {
|
||||
ImagePreviewOptions,
|
||||
ImagePreviewInstance,
|
||||
|
||||
@ -104,7 +104,7 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get IndexB
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { IndexBarInstance } from 'vant';
|
||||
import type { IndexBarProps, IndexBarInstance } from 'vant';
|
||||
```
|
||||
|
||||
`IndexBarInstance` is the type of component instance:
|
||||
|
||||
@ -108,7 +108,7 @@ export default {
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { IndexBarInstance } from 'vant';
|
||||
import type { IndexBarProps, IndexBarInstance } from 'vant';
|
||||
```
|
||||
|
||||
`IndexBarInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _IndexBar from './IndexBar';
|
||||
import _IndexBar, { IndexBarProps } from './IndexBar';
|
||||
|
||||
export const IndexBar = withInstall(_IndexBar);
|
||||
export default IndexBar;
|
||||
export type { IndexBarProps };
|
||||
export type { IndexBarInstance } from './types';
|
||||
|
||||
@ -196,7 +196,7 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get List i
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { ListInstance, ListDirection } from 'vant';
|
||||
import type { ListProps, ListInstance, ListDirection } from 'vant';
|
||||
```
|
||||
|
||||
`ListInstance` is the type of component instance:
|
||||
|
||||
@ -211,7 +211,7 @@ export default {
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { ListInstance, ListDirection } from 'vant';
|
||||
import type { ListProps, ListInstance, ListDirection } from 'vant';
|
||||
```
|
||||
|
||||
`ListInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _List from './List';
|
||||
import _List, { ListProps } from './List';
|
||||
|
||||
export const List = withInstall(_List);
|
||||
export default List;
|
||||
export type { ListProps };
|
||||
export type { ListInstance, ListDirection } from './types';
|
||||
|
||||
@ -120,7 +120,7 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get Notice
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { NoticeBarMode, NoticeBarInstance } from 'vant';
|
||||
import type { NoticeBarMode, NoticeBarProps, NoticeBarInstance } from 'vant';
|
||||
```
|
||||
|
||||
`NoticeBarInstance` is the type of component instance:
|
||||
|
||||
@ -141,7 +141,7 @@ app.use(NoticeBar);
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { NoticeBarMode, NoticeBarInstance } from 'vant';
|
||||
import type { NoticeBarMode, NoticeBarProps, NoticeBarInstance } from 'vant';
|
||||
```
|
||||
|
||||
`NoticeBarInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _NoticeBar from './NoticeBar';
|
||||
import _NoticeBar, { NoticeBarProps } from './NoticeBar';
|
||||
|
||||
export const NoticeBar = withInstall(_NoticeBar);
|
||||
export default NoticeBar;
|
||||
export type { NoticeBarProps };
|
||||
export type { NoticeBarMode, NoticeBarInstance } from './types';
|
||||
|
||||
@ -109,6 +109,7 @@ Use `title` prop to set keyboard title.
|
||||
</van-cell>
|
||||
<van-number-keyboard
|
||||
:show="show"
|
||||
theme="custom"
|
||||
:extra-key="['00', '.']"
|
||||
close-button-text="Close"
|
||||
@blur="show = false"
|
||||
|
||||
@ -116,6 +116,7 @@ export default {
|
||||
</van-cell>
|
||||
<van-number-keyboard
|
||||
:show="show"
|
||||
theme="custom"
|
||||
:extra-key="['00', '.']"
|
||||
close-button-text="完成"
|
||||
@blur="show = false"
|
||||
|
||||
@ -385,6 +385,7 @@ The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type {
|
||||
PickerProps,
|
||||
PickerColumn,
|
||||
PickerOption,
|
||||
PickerInstance,
|
||||
|
||||
@ -410,6 +410,7 @@ export default {
|
||||
|
||||
```ts
|
||||
import type {
|
||||
PickerProps,
|
||||
PickerColumn,
|
||||
PickerOption,
|
||||
PickerInstance,
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Picker from './Picker';
|
||||
import _Picker, { PickerProps } from './Picker';
|
||||
|
||||
export const Picker = withInstall(_Picker);
|
||||
export default Picker;
|
||||
export type { PickerProps };
|
||||
export type {
|
||||
PickerColumn,
|
||||
PickerOption,
|
||||
|
||||
@ -74,7 +74,7 @@ Use `pivot-text` to custom text,use `color` to custom bar color.
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { ProgressInstance } from 'vant';
|
||||
import type { ProgressProps, ProgressInstance } from 'vant';
|
||||
```
|
||||
|
||||
`ProgressInstance` is the type of component instance:
|
||||
|
||||
@ -78,7 +78,7 @@ app.use(Progress);
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { ProgressInstance } from 'vant';
|
||||
import type { ProgressProps, ProgressInstance } from 'vant';
|
||||
```
|
||||
|
||||
`ProgressInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Progress from './Progress';
|
||||
import _Progress, { ProgressProps } from './Progress';
|
||||
|
||||
export const Progress = withInstall(_Progress);
|
||||
export default Progress;
|
||||
export type { ProgressProps };
|
||||
export type { ProgressInstance } from './types';
|
||||
|
||||
@ -139,6 +139,7 @@ Use `action` slot to custom right button, `cancel` event will no longer be Emitt
|
||||
| input-align | Text align of field, can be set to `center` `right` | _string_ | `left` |
|
||||
| left-icon | Left icon name | _string_ | `search` |
|
||||
| right-icon | Right icon name | _string_ | - |
|
||||
| autocomplete `v3.2.3` | [autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) attribute of native input element | _string_ | - |
|
||||
|
||||
### Events
|
||||
|
||||
@ -166,7 +167,7 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get Search
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { SearchShape, SearchInstance } from 'vant';
|
||||
import type { SearchProps, SearchShape, SearchInstance } from 'vant';
|
||||
```
|
||||
|
||||
`SearchInstance` is the type of component instance:
|
||||
|
||||
@ -151,6 +151,7 @@ export default {
|
||||
| input-align | 输入框内容对齐方式,可选值为 `center` `right` | _string_ | `left` |
|
||||
| left-icon | 输入框左侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | `search` |
|
||||
| right-icon | 输入框右侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | - |
|
||||
| autocomplete `v3.2.3` | input 标签原生的[自动完成属性](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | _string_ | - |
|
||||
|
||||
### Events
|
||||
|
||||
@ -178,7 +179,7 @@ export default {
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { SearchShape, SearchInstance } from 'vant';
|
||||
import type { SearchProps, SearchShape, SearchInstance } from 'vant';
|
||||
```
|
||||
|
||||
`SearchInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Search from './Search';
|
||||
import _Search, { SearchProps } from './Search';
|
||||
|
||||
export const Search = withInstall(_Search);
|
||||
export default Search;
|
||||
export type { SearchProps };
|
||||
export type { SearchShape, SearchInstance } from './types';
|
||||
|
||||
@ -150,3 +150,14 @@ test('should render id prop correctly', async () => {
|
||||
expect(wrapper.find('input').attributes('id')).toEqual('my-id');
|
||||
expect(wrapper.find('label').attributes('for')).toEqual('my-id');
|
||||
});
|
||||
|
||||
test('should allow to set autocomplete attribute', () => {
|
||||
const wrapper = mount(Search, {
|
||||
props: {
|
||||
autocomplete: 'on',
|
||||
},
|
||||
});
|
||||
expect(wrapper.find('input').element.getAttribute('autocomplete')).toEqual(
|
||||
'on'
|
||||
);
|
||||
});
|
||||
|
||||
@ -151,7 +151,12 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get SwipeC
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { SwipeCellSide, SwipeCellPosition, SwipeCellInstance } from 'vant';
|
||||
import type {
|
||||
SwipeCellSide,
|
||||
SwipeCellProps,
|
||||
SwipeCellPosition,
|
||||
SwipeCellInstance,
|
||||
} from 'vant';
|
||||
```
|
||||
|
||||
`SwipeCellInstance` is the type of component instance:
|
||||
|
||||
@ -160,7 +160,12 @@ beforeClose 的第一个参数为对象,对象中包含以下属性:
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { SwipeCellSide, SwipeCellPosition, SwipeCellInstance } from 'vant';
|
||||
import type {
|
||||
SwipeCellSide,
|
||||
SwipeCellProps,
|
||||
SwipeCellPosition,
|
||||
SwipeCellInstance,
|
||||
} from 'vant';
|
||||
```
|
||||
|
||||
`SwipeCellInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _SwipeCell from './SwipeCell';
|
||||
import _SwipeCell, { SwipeCellProps } from './SwipeCell';
|
||||
|
||||
export const SwipeCell = withInstall(_SwipeCell);
|
||||
export default SwipeCell;
|
||||
export type { SwipeCellProps };
|
||||
export type {
|
||||
SwipeCellSide,
|
||||
SwipeCellPosition,
|
||||
|
||||
@ -184,7 +184,7 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get Swipe
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { SwipeInstance, SwipeToOptions } from 'vant';
|
||||
import type { SwipeProps, SwipeInstance, SwipeToOptions } from 'vant';
|
||||
```
|
||||
|
||||
`SwipeInstance` is the type of component instance:
|
||||
|
||||
@ -192,7 +192,7 @@ export default {
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { SwipeInstance, SwipeToOptions } from 'vant';
|
||||
import type { SwipeProps, SwipeInstance, SwipeToOptions } from 'vant';
|
||||
```
|
||||
|
||||
`SwipeInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Swipe from './Swipe';
|
||||
import _Swipe, { SwipeProps } from './Swipe';
|
||||
|
||||
export const Swipe = withInstall(_Swipe);
|
||||
export default Swipe;
|
||||
export type { SwipeProps };
|
||||
export type { SwipeInstance, SwipeToOptions } from './types';
|
||||
|
||||
@ -286,7 +286,7 @@ Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get Tabs i
|
||||
The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type { TabsType, TabsInstance } from 'vant';
|
||||
import type { TabsType, TabsProps, TabsInstance } from 'vant';
|
||||
```
|
||||
|
||||
`TabsInstance` is the type of component instance:
|
||||
|
||||
@ -299,7 +299,7 @@ export default {
|
||||
组件导出以下类型定义:
|
||||
|
||||
```ts
|
||||
import type { TabsType, TabsInstance } from 'vant';
|
||||
import type { TabsType, TabsProps, TabsInstance } from 'vant';
|
||||
```
|
||||
|
||||
`TabsInstance` 是组件实例的类型,用法如下:
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Tabs from './Tabs';
|
||||
import _Tabs, { TabsProps } from './Tabs';
|
||||
|
||||
export const Tabs = withInstall(_Tabs);
|
||||
export default Tabs;
|
||||
export type { TabsProps };
|
||||
export type { TabsType, TabsInstance } from './types';
|
||||
|
||||
@ -363,6 +363,7 @@ The component exports the following type definitions:
|
||||
|
||||
```ts
|
||||
import type {
|
||||
UploaderProps,
|
||||
UploaderInstance,
|
||||
UploaderResultType,
|
||||
UploaderFileListItem,
|
||||
|
||||
@ -388,6 +388,7 @@ before-read、after-read、before-delete 执行时会传递以下回调参数:
|
||||
|
||||
```ts
|
||||
import type {
|
||||
UploaderProps,
|
||||
UploaderInstance,
|
||||
UploaderResultType,
|
||||
UploaderFileListItem,
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Uploader from './Uploader';
|
||||
import _Uploader, { UploaderProps } from './Uploader';
|
||||
|
||||
export const Uploader = withInstall(_Uploader);
|
||||
export default Uploader;
|
||||
export type { UploaderProps };
|
||||
export type {
|
||||
UploaderInstance,
|
||||
UploaderResultType,
|
||||
|
||||
@ -76,6 +76,10 @@ module.exports = {
|
||||
path: 'advanced-usage',
|
||||
title: '进阶用法',
|
||||
},
|
||||
{
|
||||
path: 'faq',
|
||||
title: '常见问题',
|
||||
},
|
||||
{
|
||||
path: 'changelog',
|
||||
title: '更新日志',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user