From 5aabf066e6bbab81be8fbf53a309d96f31aadfdd Mon Sep 17 00:00:00 2001 From: blackie Date: Tue, 1 Mar 2022 22:16:46 +0800 Subject: [PATCH] refactor(components): [page-header] switch to script-setup syntax (#6321) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 三咲智子 --- .../components/page-header/src/page-header.ts | 14 ++++--- .../page-header/src/page-header.vue | 40 +++++++------------ 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/packages/components/page-header/src/page-header.ts b/packages/components/page-header/src/page-header.ts index 77cdd5fa22..7a589c811a 100644 --- a/packages/components/page-header/src/page-header.ts +++ b/packages/components/page-header/src/page-header.ts @@ -1,20 +1,24 @@ +import { iconPropType, buildProps } from '@element-plus/utils' import { Back } from '@element-plus/icons-vue' -import type { ExtractPropTypes, PropType, Component } from 'vue' +import type { ExtractPropTypes } from 'vue' +import type PageHeader from './page-header.vue' -export const pageHeaderProps = { +export const pageHeaderProps = buildProps({ icon: { - type: [String, Object] as PropType, - default: Back, + type: iconPropType, + default: () => Back, }, title: String, content: { type: String, default: '', }, -} as const +} as const) export type PageHeaderProps = ExtractPropTypes export const pageHeaderEmits = { back: () => true, } export type PageHeaderEmits = typeof pageHeaderEmits + +export type PageHeaderInstance = InstanceType diff --git a/packages/components/page-header/src/page-header.vue b/packages/components/page-header/src/page-header.vue index 7510536fa5..262774d9a1 100644 --- a/packages/components/page-header/src/page-header.vue +++ b/packages/components/page-header/src/page-header.vue @@ -3,7 +3,9 @@
- + + +
@@ -15,36 +17,22 @@
-