diff --git a/packages/components/link/__tests__/link.spec.ts b/packages/components/link/__tests__/link.spec.ts index a100e3de2d..d8fab0c7e7 100644 --- a/packages/components/link/__tests__/link.spec.ts +++ b/packages/components/link/__tests__/link.spec.ts @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils' -import Link from '../src/index.vue' +import Link from '../src/link.vue' const AXIOM = 'Rem is the best girl' diff --git a/packages/components/link/index.ts b/packages/components/link/index.ts index 052e2bfaf2..64bcf56f4b 100644 --- a/packages/components/link/index.ts +++ b/packages/components/link/index.ts @@ -1,13 +1,8 @@ -import Link from './src/index.vue' +import { withInstall } from '@element-plus/utils/with-install' -import type { App } from 'vue' -import type { SFCWithInstall } from '@element-plus/utils/types' +import Link from './src/link.vue' -Link.install = (app: App): void => { - app.component(Link.name, Link) -} +export const ElLink = withInstall(Link) +export default ElLink -const _Link = Link as SFCWithInstall - -export default _Link -export const ElLink = _Link +export * from './src/link' diff --git a/packages/components/link/src/index.vue b/packages/components/link/src/index.vue deleted file mode 100644 index 28818fd757..0000000000 --- a/packages/components/link/src/index.vue +++ /dev/null @@ -1,67 +0,0 @@ - - diff --git a/packages/components/link/src/link.ts b/packages/components/link/src/link.ts new file mode 100644 index 0000000000..8b05de41e1 --- /dev/null +++ b/packages/components/link/src/link.ts @@ -0,0 +1,24 @@ +import { buildProp } from '@element-plus/utils/props' + +import type { ExtractPropTypes } from 'vue' + +export const linkProps = { + type: buildProp({ + type: String, + values: ['primary', 'success', 'warning', 'info', 'danger', 'default'], + default: 'default', + } as const), + underline: { + type: Boolean, + default: true, + }, + disabled: { type: Boolean, default: false }, + href: { type: String, default: '' }, + icon: { type: String, default: '' }, +} as const +export type LinkProps = ExtractPropTypes + +export const linkEmits = { + click: (evt: MouseEvent) => evt instanceof MouseEvent, +} +export type LinkEmits = typeof linkEmits diff --git a/packages/components/link/src/link.vue b/packages/components/link/src/link.vue new file mode 100644 index 0000000000..50b1548c4d --- /dev/null +++ b/packages/components/link/src/link.vue @@ -0,0 +1,41 @@ + +