Compare commits

...

3 Commits

Author SHA1 Message Date
neverland
5c080f3a6e
types: improve Field injection typing (#8975)
* types: improve inject typing

* types: update
2021-07-03 20:05:14 +08:00
chenjiahan
11e856d099 docs(changelog): 3.1.2 2021-07-03 16:48:16 +08:00
chenjiahan
d7d98eb340 chore: release 3.1.2 2021-07-03 16:45:41 +08:00
5 changed files with 50 additions and 6 deletions

View File

@ -16,6 +16,24 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
## Details
### [v3.1.2](https://github.com/youzan/vant/compare/v3.1.1...v3.1.2)
`2021-07-03`
**Feature**
- Area: add toolbar、confirm、cancel slots [#8969](https://github.com/youzan/vant/issues/8969)
- Calendar: simplify placeholder dom [#8955](https://github.com/youzan/vant/issues/8955)
- Cascader: add disabled option [#8952](https://github.com/youzan/vant/issues/8952)
- ConfigProvider: add tag prop [#8967](https://github.com/youzan/vant/issues/8967)
- Picker: add toolbar slot [#8968](https://github.com/youzan/vant/issues/8968)
- Picker: allow option text to be number type [#8951](https://github.com/youzan/vant/issues/8951)
- Picker: add picker-option-padding CSS var [#8947](https://github.com/youzan/vant/issues/8947)
**Bug Fixes**
- Toast: fix word break [#8965](https://github.com/youzan/vant/issues/8965)
### [v3.1.1](https://github.com/youzan/vant/compare/v3.1.0...v3.1.1)
`2021-06-27`

View File

@ -16,13 +16,31 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
## 更新内容
### [v3.1.2](https://github.com/youzan/vant/compare/v3.1.1...v3.1.2)
`2021-07-03`
**Feature**
- Area: 新增 toolbar、confirm、cancel 插槽 [#8969](https://github.com/youzan/vant/issues/8969)
- Calendar: 优化日期较多时的加载性能 [#8955](https://github.com/youzan/vant/issues/8955)
- Cascader: 新增 disabled 选项 [#8952](https://github.com/youzan/vant/issues/8952)
- ConfigProvider: 新增 tag 属性 [#8967](https://github.com/youzan/vant/issues/8967)
- Picker: 新增 toolbar 插槽,将 default 插槽标记为废弃 [#8968](https://github.com/youzan/vant/issues/8968)
- Picker: 允许 Option 的值为 number 类型 [#8951](https://github.com/youzan/vant/issues/8951)
- Picker: 新增 picker-option-padding CSS 变量 [#8947](https://github.com/youzan/vant/issues/8947)
**Bug Fixes**
- Toast: 修复文字换行问题 [#8965](https://github.com/youzan/vant/issues/8965)
### [v3.1.1](https://github.com/youzan/vant/compare/v3.1.0...v3.1.1)
`2021-06-27`
**Feature**
- Cell: 新增 value 插槽 [#8933](https://github.com/youzan/vant/issues/8933)
- Cell: 新增 value 插槽,将 default 插槽标记为废弃 [#8933](https://github.com/youzan/vant/issues/8933)
- CollapseItem: 新增 label 插槽 [#8934](https://github.com/youzan/vant/issues/8934)
- NoticeBar: 新增 reset 方法 [#8917](https://github.com/youzan/vant/issues/8917)
- Tabs: 新增 nav-bottom 插槽 [#8915](https://github.com/youzan/vant/issues/8915)

View File

@ -1,6 +1,6 @@
{
"name": "vant",
"version": "3.1.1",
"version": "3.1.2",
"description": "Mobile UI Components built on Vue",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -1,11 +1,11 @@
import { ComponentInstance } from '../utils';
import { watch, inject } from 'vue';
import { watch, inject, InjectionKey } from 'vue';
import type { FieldProvide } from '../field/types';
export const FORM_KEY = Symbol('van-form');
export const FIELD_KEY = Symbol('van-field');
export const FIELD_KEY: InjectionKey<FieldProvide> = Symbol('van-field');
export function useLinkField(getValue: () => unknown) {
const field = inject(FIELD_KEY, null) as ComponentInstance | null;
const field = inject(FIELD_KEY, null);
if (field && !field.childFieldValue.value) {
field.childFieldValue.value = getValue;

View File

@ -1,3 +1,5 @@
import type { Ref } from 'vue';
export type FieldType =
| 'tel'
| 'text'
@ -37,6 +39,12 @@ export type FieldRule = {
formatter?: (value: any, rule: FieldRule) => string;
};
export type FieldProvide = {
childFieldValue: Ref<(() => unknown) | undefined>;
resetValidation: () => void;
validateWithTrigger: (trigger: FieldValidateTrigger) => void;
};
declare global {
interface EventTarget {
composing?: boolean;