chore: using symbol as provide key (#8260)

This commit is contained in:
neverland 2021-03-04 10:58:36 +08:00 committed by GitHub
parent d20a2bd578
commit 831091182a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 16 additions and 16 deletions

View File

@ -3,7 +3,7 @@ import { useChildren } from '@vant/use';
const [createComponent, bem] = createNamespace('action-bar'); const [createComponent, bem] = createNamespace('action-bar');
export const ACTION_BAR_KEY = 'vanActionBar'; export const ACTION_BAR_KEY = Symbol('ActionBar');
export default createComponent({ export default createComponent({
props: { props: {

View File

@ -7,7 +7,7 @@ import { CheckerParent, CheckerDirection } from '../checkbox/Checker';
const [createComponent, bem] = createNamespace('checkbox-group'); const [createComponent, bem] = createNamespace('checkbox-group');
export const CHECKBOX_GROUP_KEY = 'vanCheckboxGroup'; export const CHECKBOX_GROUP_KEY = Symbol('CheckboxGroup');
export type CheckboxGroupToggleAllOptions = export type CheckboxGroupToggleAllOptions =
| boolean | boolean

View File

@ -5,7 +5,7 @@ import { useChildren } from '@vant/use';
const [createComponent, bem] = createNamespace('collapse'); const [createComponent, bem] = createNamespace('collapse');
export const COLLAPSE_KEY = 'vanCollapse'; export const COLLAPSE_KEY = Symbol('Collapse');
export type CollapseProvide = { export type CollapseProvide = {
toggle: (name: number | string, expanded: boolean) => void; toggle: (name: number | string, expanded: boolean) => void;

View File

@ -1,8 +1,8 @@
import { ComponentInstance } from '../utils'; import { ComponentInstance } from '../utils';
import { watch, inject } from 'vue'; import { watch, inject } from 'vue';
export const FORM_KEY = 'vanForm'; export const FORM_KEY = Symbol('Form');
export const FIELD_KEY = 'vanField'; export const FIELD_KEY = Symbol('Field');
export function useLinkField(getValue: () => unknown) { export function useLinkField(getValue: () => unknown) {
const field = inject(FIELD_KEY, null) as ComponentInstance | null; const field = inject(FIELD_KEY, null) as ComponentInstance | null;

View File

@ -14,7 +14,7 @@ import {
const [createComponent, bem] = createNamespace('dropdown-menu'); const [createComponent, bem] = createNamespace('dropdown-menu');
export const DROPDOWN_KEY = 'vanDropdownMenu'; export const DROPDOWN_KEY = Symbol('DropdownMenu');
export type DropdownMenuDirection = 'up' | 'down'; export type DropdownMenuDirection = 'up' | 'down';

View File

@ -5,7 +5,7 @@ import { useChildren } from '@vant/use';
const [createComponent, bem] = createNamespace('grid'); const [createComponent, bem] = createNamespace('grid');
export const GRID_KEY = 'vanGrid'; export const GRID_KEY = Symbol('Grid');
export type GridDirection = 'horizontal' | 'vertical'; export type GridDirection = 'horizontal' | 'vertical';

View File

@ -30,7 +30,7 @@ import {
import { useTouch } from '../composables/use-touch'; import { useTouch } from '../composables/use-touch';
import { useExpose } from '../composables/use-expose'; import { useExpose } from '../composables/use-expose';
export const INDEX_BAR_KEY = 'vanIndexBar'; export const INDEX_BAR_KEY = Symbol('IndexBar');
export type IndexBarProvide = { export type IndexBarProvide = {
props: { props: {

View File

@ -34,7 +34,7 @@ function getElementTranslateY(element: Element) {
return Number(translateY); return Number(translateY);
} }
export const PICKER_KEY = 'vanPicker'; export const PICKER_KEY = Symbol('Picker');
export type PickerObjectOption = { export type PickerObjectOption = {
text?: string; text?: string;

View File

@ -6,7 +6,7 @@ import { CheckerParent } from '../checkbox/Checker';
const [createComponent, bem] = createNamespace('radio-group'); const [createComponent, bem] = createNamespace('radio-group');
export const RADIO_KEY = 'vanRadio'; export const RADIO_KEY = Symbol('RadioGroup');
export type RadioGroupProvide = CheckerParent & { export type RadioGroupProvide = CheckerParent & {
props: { props: {

View File

@ -4,7 +4,7 @@ import { useChildren } from '@vant/use';
const [createComponent, bem] = createNamespace('row'); const [createComponent, bem] = createNamespace('row');
export const ROW_KEY = 'vanRow'; export const ROW_KEY = Symbol('Row');
export type RowSpaces = { left?: number; right: number }[]; export type RowSpaces = { left?: number; right: number }[];

View File

@ -3,7 +3,7 @@ import { useChildren } from '@vant/use';
const [createComponent, bem] = createNamespace('sidebar'); const [createComponent, bem] = createNamespace('sidebar');
export const SIDEBAR_KEY = 'vanSidebar'; export const SIDEBAR_KEY = Symbol('Sidebar');
export type SidebarProvide = { export type SidebarProvide = {
getActive: () => number; getActive: () => number;

View File

@ -4,7 +4,7 @@ import { useChildren } from '@vant/use';
const [createComponent, bem] = createNamespace('steps'); const [createComponent, bem] = createNamespace('steps');
export const STEPS_KEY = 'vanSteps'; export const STEPS_KEY = Symbol('Steps');
export type StepsDirection = 'horizontal' | 'vertical'; export type StepsDirection = 'horizontal' | 'vertical';

View File

@ -33,7 +33,7 @@ import { useExpose } from '../composables/use-expose';
const [createComponent, bem] = createNamespace('swipe'); const [createComponent, bem] = createNamespace('swipe');
export const SWIPE_KEY = 'vanSwipe'; export const SWIPE_KEY = Symbol('Swipe');
export type SwipeToOptions = { export type SwipeToOptions = {
immediate?: boolean; immediate?: boolean;

View File

@ -11,7 +11,7 @@ import { usePlaceholder } from '../composables/use-placeholder';
const [createComponent, bem] = createNamespace('tabbar'); const [createComponent, bem] = createNamespace('tabbar');
export const TABBAR_KEY = 'vanTabbar'; export const TABBAR_KEY = Symbol('Tabbar');
export type TabbarProvide = { export type TabbarProvide = {
props: { props: {

View File

@ -47,7 +47,7 @@ import TabsContent from './TabsContent';
const [createComponent, bem] = createNamespace('tabs'); const [createComponent, bem] = createNamespace('tabs');
export const TABS_KEY = 'vanTabs'; export const TABS_KEY = Symbol('Tabs');
export type TabType = 'line' | 'card'; export type TabType = 'line' | 'card';