diff --git a/src/action-bar/index.tsx b/src/action-bar/index.tsx index e3e631052..4063eaa03 100644 --- a/src/action-bar/index.tsx +++ b/src/action-bar/index.tsx @@ -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: { diff --git a/src/checkbox-group/index.tsx b/src/checkbox-group/index.tsx index 057a97dc2..0ccca62d6 100644 --- a/src/checkbox-group/index.tsx +++ b/src/checkbox-group/index.tsx @@ -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 diff --git a/src/collapse/index.tsx b/src/collapse/index.tsx index 78d4b2f8e..a5b0237be 100644 --- a/src/collapse/index.tsx +++ b/src/collapse/index.tsx @@ -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; diff --git a/src/composables/use-link-field.ts b/src/composables/use-link-field.ts index e31ad93df..1c564f9ba 100644 --- a/src/composables/use-link-field.ts +++ b/src/composables/use-link-field.ts @@ -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; diff --git a/src/dropdown-menu/index.tsx b/src/dropdown-menu/index.tsx index cb7c3a2b9..a6c3068aa 100644 --- a/src/dropdown-menu/index.tsx +++ b/src/dropdown-menu/index.tsx @@ -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'; diff --git a/src/grid/index.tsx b/src/grid/index.tsx index fd20faef3..ec56f36a9 100644 --- a/src/grid/index.tsx +++ b/src/grid/index.tsx @@ -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'; diff --git a/src/index-bar/index.tsx b/src/index-bar/index.tsx index 93090b58f..d9cedf35d 100644 --- a/src/index-bar/index.tsx +++ b/src/index-bar/index.tsx @@ -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: { diff --git a/src/picker/PickerColumn.tsx b/src/picker/PickerColumn.tsx index d22e7441d..334fb429d 100644 --- a/src/picker/PickerColumn.tsx +++ b/src/picker/PickerColumn.tsx @@ -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; diff --git a/src/radio-group/index.tsx b/src/radio-group/index.tsx index dd6ffc830..3cd9536d8 100644 --- a/src/radio-group/index.tsx +++ b/src/radio-group/index.tsx @@ -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: { diff --git a/src/row/index.tsx b/src/row/index.tsx index 8b5e694cf..e4628dcdd 100644 --- a/src/row/index.tsx +++ b/src/row/index.tsx @@ -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 }[]; diff --git a/src/sidebar/index.tsx b/src/sidebar/index.tsx index d12913e7b..b56582a56 100644 --- a/src/sidebar/index.tsx +++ b/src/sidebar/index.tsx @@ -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; diff --git a/src/steps/index.tsx b/src/steps/index.tsx index 0d35e88d5..95cd4f3f0 100644 --- a/src/steps/index.tsx +++ b/src/steps/index.tsx @@ -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'; diff --git a/src/swipe/index.tsx b/src/swipe/index.tsx index f34a863bf..3d0ae040b 100644 --- a/src/swipe/index.tsx +++ b/src/swipe/index.tsx @@ -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; diff --git a/src/tabbar/index.tsx b/src/tabbar/index.tsx index a2c184e30..909ce20bd 100644 --- a/src/tabbar/index.tsx +++ b/src/tabbar/index.tsx @@ -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: { diff --git a/src/tabs/index.tsx b/src/tabs/index.tsx index 5fb394d5b..a5e00ee28 100644 --- a/src/tabs/index.tsx +++ b/src/tabs/index.tsx @@ -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';