forked from element-plus/element-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(components): refactor result
- Loading branch information
Showing
4 changed files
with
48 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import Result from './src/index.vue' | ||
import { withInstall } from '@element-plus/utils/with-install' | ||
import Result from './src/result.vue' | ||
|
||
import type { App } from 'vue' | ||
import type { SFCWithInstall } from '@element-plus/utils/types' | ||
export const ElResult = withInstall(Result) | ||
|
||
Result.install = (app: App): void => { | ||
app.component(Result.name, Result) | ||
} | ||
export default ElResult | ||
|
||
const _Result = Result as SFCWithInstall<typeof Result> | ||
|
||
export default _Result | ||
export const ElResult = _Result | ||
export * from './src/result' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { buildProps } from '@element-plus/utils/props' | ||
import { | ||
WarningFilled, | ||
CircleCheckFilled, | ||
CircleCloseFilled, | ||
InfoFilled, | ||
} from '@element-plus/icons' | ||
import type { Indexable } from '@element-plus/utils/types' | ||
import type { Component, ExtractPropTypes } from 'vue' | ||
|
||
export const IconMap: Indexable<string> = { | ||
success: 'icon-success', | ||
warning: 'icon-warning', | ||
error: 'icon-error', | ||
info: 'icon-info', | ||
} | ||
|
||
export const IconComponentMap: Indexable<Component> = { | ||
[IconMap.success]: CircleCheckFilled, | ||
[IconMap.warning]: WarningFilled, | ||
[IconMap.error]: CircleCloseFilled, | ||
[IconMap.info]: InfoFilled, | ||
} | ||
|
||
export const resultProps = buildProps({ | ||
title: { | ||
type: String, | ||
default: '', | ||
}, | ||
subTitle: { | ||
type: String, | ||
default: '', | ||
}, | ||
icon: { | ||
type: String, | ||
default: 'info', | ||
}, | ||
} as const) | ||
|
||
export type ResultProps = ExtractPropTypes<typeof resultProps> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters