mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: using symbol as provide key (#8260)
This commit is contained in:
parent
d20a2bd578
commit
831091182a
@ -3,7 +3,7 @@ import { useChildren } from '@vant/use';
|
||||
|
||||
const [createComponent, bem] = createNamespace('action-bar');
|
||||
|
||||
export const ACTION_BAR_KEY = 'vanActionBar';
|
||||
export const ACTION_BAR_KEY = Symbol('ActionBar');
|
||||
|
||||
export default createComponent({
|
||||
props: {
|
||||
|
@ -7,7 +7,7 @@ import { CheckerParent, CheckerDirection } from '../checkbox/Checker';
|
||||
|
||||
const [createComponent, bem] = createNamespace('checkbox-group');
|
||||
|
||||
export const CHECKBOX_GROUP_KEY = 'vanCheckboxGroup';
|
||||
export const CHECKBOX_GROUP_KEY = Symbol('CheckboxGroup');
|
||||
|
||||
export type CheckboxGroupToggleAllOptions =
|
||||
| boolean
|
||||
|
@ -5,7 +5,7 @@ import { useChildren } from '@vant/use';
|
||||
|
||||
const [createComponent, bem] = createNamespace('collapse');
|
||||
|
||||
export const COLLAPSE_KEY = 'vanCollapse';
|
||||
export const COLLAPSE_KEY = Symbol('Collapse');
|
||||
|
||||
export type CollapseProvide = {
|
||||
toggle: (name: number | string, expanded: boolean) => void;
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { ComponentInstance } from '../utils';
|
||||
import { watch, inject } from 'vue';
|
||||
|
||||
export const FORM_KEY = 'vanForm';
|
||||
export const FIELD_KEY = 'vanField';
|
||||
export const FORM_KEY = Symbol('Form');
|
||||
export const FIELD_KEY = Symbol('Field');
|
||||
|
||||
export function useLinkField(getValue: () => unknown) {
|
||||
const field = inject(FIELD_KEY, null) as ComponentInstance | null;
|
||||
|
@ -14,7 +14,7 @@ import {
|
||||
|
||||
const [createComponent, bem] = createNamespace('dropdown-menu');
|
||||
|
||||
export const DROPDOWN_KEY = 'vanDropdownMenu';
|
||||
export const DROPDOWN_KEY = Symbol('DropdownMenu');
|
||||
|
||||
export type DropdownMenuDirection = 'up' | 'down';
|
||||
|
||||
|
@ -5,7 +5,7 @@ import { useChildren } from '@vant/use';
|
||||
|
||||
const [createComponent, bem] = createNamespace('grid');
|
||||
|
||||
export const GRID_KEY = 'vanGrid';
|
||||
export const GRID_KEY = Symbol('Grid');
|
||||
|
||||
export type GridDirection = 'horizontal' | 'vertical';
|
||||
|
||||
|
@ -30,7 +30,7 @@ import {
|
||||
import { useTouch } from '../composables/use-touch';
|
||||
import { useExpose } from '../composables/use-expose';
|
||||
|
||||
export const INDEX_BAR_KEY = 'vanIndexBar';
|
||||
export const INDEX_BAR_KEY = Symbol('IndexBar');
|
||||
|
||||
export type IndexBarProvide = {
|
||||
props: {
|
||||
|
@ -34,7 +34,7 @@ function getElementTranslateY(element: Element) {
|
||||
return Number(translateY);
|
||||
}
|
||||
|
||||
export const PICKER_KEY = 'vanPicker';
|
||||
export const PICKER_KEY = Symbol('Picker');
|
||||
|
||||
export type PickerObjectOption = {
|
||||
text?: string;
|
||||
|
@ -6,7 +6,7 @@ import { CheckerParent } from '../checkbox/Checker';
|
||||
|
||||
const [createComponent, bem] = createNamespace('radio-group');
|
||||
|
||||
export const RADIO_KEY = 'vanRadio';
|
||||
export const RADIO_KEY = Symbol('RadioGroup');
|
||||
|
||||
export type RadioGroupProvide = CheckerParent & {
|
||||
props: {
|
||||
|
@ -4,7 +4,7 @@ import { useChildren } from '@vant/use';
|
||||
|
||||
const [createComponent, bem] = createNamespace('row');
|
||||
|
||||
export const ROW_KEY = 'vanRow';
|
||||
export const ROW_KEY = Symbol('Row');
|
||||
|
||||
export type RowSpaces = { left?: number; right: number }[];
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { useChildren } from '@vant/use';
|
||||
|
||||
const [createComponent, bem] = createNamespace('sidebar');
|
||||
|
||||
export const SIDEBAR_KEY = 'vanSidebar';
|
||||
export const SIDEBAR_KEY = Symbol('Sidebar');
|
||||
|
||||
export type SidebarProvide = {
|
||||
getActive: () => number;
|
||||
|
@ -4,7 +4,7 @@ import { useChildren } from '@vant/use';
|
||||
|
||||
const [createComponent, bem] = createNamespace('steps');
|
||||
|
||||
export const STEPS_KEY = 'vanSteps';
|
||||
export const STEPS_KEY = Symbol('Steps');
|
||||
|
||||
export type StepsDirection = 'horizontal' | 'vertical';
|
||||
|
||||
|
@ -33,7 +33,7 @@ import { useExpose } from '../composables/use-expose';
|
||||
|
||||
const [createComponent, bem] = createNamespace('swipe');
|
||||
|
||||
export const SWIPE_KEY = 'vanSwipe';
|
||||
export const SWIPE_KEY = Symbol('Swipe');
|
||||
|
||||
export type SwipeToOptions = {
|
||||
immediate?: boolean;
|
||||
|
@ -11,7 +11,7 @@ import { usePlaceholder } from '../composables/use-placeholder';
|
||||
|
||||
const [createComponent, bem] = createNamespace('tabbar');
|
||||
|
||||
export const TABBAR_KEY = 'vanTabbar';
|
||||
export const TABBAR_KEY = Symbol('Tabbar');
|
||||
|
||||
export type TabbarProvide = {
|
||||
props: {
|
||||
|
@ -47,7 +47,7 @@ import TabsContent from './TabsContent';
|
||||
|
||||
const [createComponent, bem] = createNamespace('tabs');
|
||||
|
||||
export const TABS_KEY = 'vanTabs';
|
||||
export const TABS_KEY = Symbol('Tabs');
|
||||
|
||||
export type TabType = 'line' | 'card';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user