mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: rename useParentField to useLinkField
This commit is contained in:
parent
7bf95d4bcf
commit
9010a0edf1
@ -3,7 +3,7 @@ import { createNamespace } from '../utils';
|
|||||||
import { CHECKBOX_KEY } from '../checkbox';
|
import { CHECKBOX_KEY } from '../checkbox';
|
||||||
import { useExpose } from '../composition/use-expose';
|
import { useExpose } from '../composition/use-expose';
|
||||||
import { useChildren } from '../composition/use-relation';
|
import { useChildren } from '../composition/use-relation';
|
||||||
import { useParentField } from '../composition/use-parent-field';
|
import { useLinkField } from '../composition/use-link-field';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('checkbox-group');
|
const [createComponent, bem] = createNamespace('checkbox-group');
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ export default createComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
useExpose({ toggleAll });
|
useExpose({ toggleAll });
|
||||||
useParentField(() => props.modelValue);
|
useLinkField(() => props.modelValue);
|
||||||
linkChildren({ emit, props });
|
linkChildren({ emit, props });
|
||||||
|
|
||||||
return () => <div class={bem([props.direction])}>{slots.default?.()}</div>;
|
return () => <div class={bem([props.direction])}>{slots.default?.()}</div>;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { computed, watch } from 'vue';
|
import { computed, watch } from 'vue';
|
||||||
import { createNamespace, pick } from '../utils';
|
import { createNamespace, pick } from '../utils';
|
||||||
import { useExpose } from '../composition/use-expose';
|
import { useExpose } from '../composition/use-expose';
|
||||||
import { useParentField } from '../composition/use-parent-field';
|
import { useLinkField } from '../composition/use-link-field';
|
||||||
import { useParent } from '../composition/use-relation';
|
import { useParent } from '../composition/use-relation';
|
||||||
import Checker, { checkerProps } from './Checker';
|
import Checker, { checkerProps } from './Checker';
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ export default createComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
useExpose({ toggle, checked });
|
useExpose({ toggle, checked });
|
||||||
useParentField(() => props.modelValue);
|
useLinkField(() => props.modelValue);
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<Checker
|
<Checker
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { watch, inject } from 'vue';
|
import { watch, inject } from 'vue';
|
||||||
import { FIELD_KEY } from '../field';
|
import { FIELD_KEY } from '../field';
|
||||||
|
|
||||||
export function useParentField(getValue: () => unknown) {
|
export function useLinkField(getValue: () => unknown) {
|
||||||
const field = inject(FIELD_KEY, null) as any;
|
const field = inject(FIELD_KEY, null) as any;
|
||||||
|
|
||||||
if (field && !field.childFieldValue.value) {
|
if (field && !field.childFieldValue.value) {
|
@ -1,7 +1,7 @@
|
|||||||
import { watch } from 'vue';
|
import { watch } from 'vue';
|
||||||
import { createNamespace } from '../utils';
|
import { createNamespace } from '../utils';
|
||||||
import { useChildren } from '../composition/use-relation';
|
import { useChildren } from '../composition/use-relation';
|
||||||
import { useParentField } from '../composition/use-parent-field';
|
import { useLinkField } from '../composition/use-link-field';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('radio-group');
|
const [createComponent, bem] = createNamespace('radio-group');
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ export default createComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
linkChildren({ emit, props });
|
linkChildren({ emit, props });
|
||||||
useParentField(() => props.modelValue);
|
useLinkField(() => props.modelValue);
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<div class={bem([props.direction])} role="radiogroup">
|
<div class={bem([props.direction])} role="radiogroup">
|
||||||
|
@ -7,7 +7,7 @@ import { preventDefault } from '../utils/dom/event';
|
|||||||
// Composition
|
// Composition
|
||||||
import { useRefs } from '../composition/use-refs';
|
import { useRefs } from '../composition/use-refs';
|
||||||
import { useTouch } from '../composition/use-touch';
|
import { useTouch } from '../composition/use-touch';
|
||||||
import { useParentField } from '../composition/use-parent-field';
|
import { useLinkField } from '../composition/use-link-field';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
@ -193,7 +193,7 @@ export default createComponent({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
useParentField(() => props.modelValue);
|
useLinkField(() => props.modelValue);
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<div
|
<div
|
||||||
|
@ -8,7 +8,7 @@ import { preventDefault } from '../utils/dom/event';
|
|||||||
// Composition
|
// Composition
|
||||||
import { useRect } from '../composition/use-rect';
|
import { useRect } from '../composition/use-rect';
|
||||||
import { useTouch } from '../composition/use-touch';
|
import { useTouch } from '../composition/use-touch';
|
||||||
import { useParentField } from '../composition/use-parent-field';
|
import { useLinkField } from '../composition/use-link-field';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('slider');
|
const [createComponent, bem] = createNamespace('slider');
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ export default createComponent({
|
|||||||
|
|
||||||
// format initial value
|
// format initial value
|
||||||
updateValue(props.modelValue);
|
updateValue(props.modelValue);
|
||||||
useParentField(() => props.modelValue);
|
useLinkField(() => props.modelValue);
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<div
|
<div
|
||||||
|
@ -8,7 +8,7 @@ import { preventDefault } from '../utils/dom/event';
|
|||||||
import { createNamespace, isDef, addUnit, getSizeStyle } from '../utils';
|
import { createNamespace, isDef, addUnit, getSizeStyle } from '../utils';
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useParentField } from '../composition/use-parent-field';
|
import { useLinkField } from '../composition/use-link-field';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('stepper');
|
const [createComponent, bem] = createNamespace('stepper');
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ export default createComponent({
|
|||||||
emit('change', value, { name: props.name });
|
emit('change', value, { name: props.name });
|
||||||
});
|
});
|
||||||
|
|
||||||
useParentField(() => props.modelValue);
|
useLinkField(() => props.modelValue);
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<div class={bem([props.theme])}>
|
<div class={bem([props.theme])}>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createNamespace, addUnit } from '../utils';
|
import { createNamespace, addUnit } from '../utils';
|
||||||
import { useParentField } from '../composition/use-parent-field';
|
import { useLinkField } from '../composition/use-link-field';
|
||||||
import Loading from '../loading';
|
import Loading from '../loading';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('switch');
|
const [createComponent, bem] = createNamespace('switch');
|
||||||
@ -42,7 +42,7 @@ export default createComponent({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useParentField(() => props.modelValue);
|
useLinkField(() => props.modelValue);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
const { size, loading, disabled, activeColor, inactiveColor } = props;
|
const { size, loading, disabled, activeColor, inactiveColor } = props;
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useExpose } from '../composition/use-expose';
|
import { useExpose } from '../composition/use-expose';
|
||||||
import { useParentField } from '../composition/use-parent-field';
|
import { useLinkField } from '../composition/use-link-field';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
@ -313,7 +313,7 @@ export default createComponent({
|
|||||||
closeImagePreview,
|
closeImagePreview,
|
||||||
});
|
});
|
||||||
|
|
||||||
useParentField(() => props.modelValue);
|
useLinkField(() => props.modelValue);
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<div class={bem()}>
|
<div class={bem()}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user