Skip to content

Commit 458a305

Browse files
committed
fix(List): fix circular reference, which confuses vite (vueComponent#4263)
1 parent b6688c4 commit 458a305

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

components/list/Item.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { cloneElement } from '../_util/vnode';
66
import { defineComponent, inject, ref } from 'vue';
77
import ItemMeta from './ItemMeta';
88
import useConfigInject from '../_util/hooks/useConfigInject';
9-
import { ListContextKey } from '.';
9+
import { ListContextKey } from './contextKey';
1010

1111
export const ListItemProps = {
1212
prefixCls: PropTypes.string,

components/list/contextKey.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { InjectionKey, Ref } from 'vue';
2+
3+
export interface ListContext {
4+
grid?: Ref<any>;
5+
itemLayout?: Ref<string>;
6+
}
7+
8+
export const ListContextKey: InjectionKey<ListContext> = Symbol('ListContextKey');

components/list/index.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { App, Plugin, ExtractPropTypes, PropType, InjectionKey, Ref } from 'vue';
1+
import type { App, Plugin, ExtractPropTypes, PropType } from 'vue';
22
import { provide, defineComponent, ref, watch, computed, toRef } from 'vue';
33
import PropTypes, { withUndefined } from '../_util/vue-types';
44
import type { RenderEmptyHandler } from '../config-provider';
@@ -70,12 +70,7 @@ export interface ListLocale {
7070

7171
export type ListProps = Partial<ExtractPropTypes<typeof listProps>>;
7272

73-
export interface ListContext {
74-
grid?: Ref<any>;
75-
itemLayout?: Ref<string>;
76-
}
77-
78-
export const ListContextKey: InjectionKey<ListContext> = Symbol('ListContextKey');
73+
import { ListContextKey } from './contextKey';
7974

8075
const List = defineComponent({
8176
name: 'AList',

0 commit comments

Comments
 (0)