1
+ import { inject } from 'vue' ;
1
2
import PropTypes from '../_util/vue-types' ;
2
- import { getComponentFromProp } from '../_util/props-util' ;
3
+ import { getComponent } from '../_util/props-util' ;
3
4
import { ConfigConsumerProps } from '../config-provider' ;
4
5
import CheckCircleFilled from '@ant-design/icons-vue/CheckCircleFilled' ;
5
6
import CloseCircleFilled from '@ant-design/icons-vue/CloseCircleFilled' ;
6
7
import ExclamationCircleFilled from '@ant-design/icons-vue/ExclamationCircleFilled' ;
7
8
import WarningFilled from '@ant-design/icons-vue/WarningFilled' ;
8
- import Base from '../base' ;
9
9
import noFound from './noFound' ;
10
10
import serverError from './serverError' ;
11
11
import unauthorized from './unauthorized' ;
@@ -55,25 +55,27 @@ const renderExtra = (h, prefixCls, extra) =>
55
55
const Result = {
56
56
name : 'AResult' ,
57
57
props : ResultProps ,
58
- inject : {
59
- configProvider : { default : ( ) => ConfigConsumerProps } ,
58
+ setup ( ) {
59
+ return {
60
+ configProvider : inject ( 'configProvider' , ConfigConsumerProps ) ,
61
+ } ;
60
62
} ,
61
63
render ( h ) {
62
64
const { prefixCls : customizePrefixCls , status } = this ;
63
65
const getPrefixCls = this . configProvider . getPrefixCls ;
64
66
const prefixCls = getPrefixCls ( 'result' , customizePrefixCls ) ;
65
67
66
- const title = getComponentFromProp ( this , 'title' ) ;
67
- const subTitle = getComponentFromProp ( this , 'subTitle' ) ;
68
- const icon = getComponentFromProp ( this , 'icon' ) ;
69
- const extra = getComponentFromProp ( this , 'extra' ) ;
68
+ const title = getComponent ( this , 'title' ) ;
69
+ const subTitle = getComponent ( this , 'subTitle' ) ;
70
+ const icon = getComponent ( this , 'icon' ) ;
71
+ const extra = getComponent ( this , 'extra' ) ;
70
72
71
73
return (
72
74
< div class = { `${ prefixCls } ${ prefixCls } -${ status } ` } >
73
75
{ renderIcon ( h , prefixCls , { status, icon } ) }
74
76
< div class = { `${ prefixCls } -title` } > { title } </ div >
75
77
{ subTitle && < div class = { `${ prefixCls } -subtitle` } > { subTitle } </ div > }
76
- { this . $slots . default && < div class = { `${ prefixCls } -content` } > { this . $slots . default } </ div > }
78
+ { this . $slots . default && < div class = { `${ prefixCls } -content` } > { this . $slots . default ( ) } </ div > }
77
79
{ renderExtra ( h , prefixCls , extra ) }
78
80
</ div >
79
81
) ;
@@ -86,8 +88,7 @@ Result.PRESENTED_IMAGE_404 = ExceptionMap[404];
86
88
Result . PRESENTED_IMAGE_500 = ExceptionMap [ 500 ] ;
87
89
88
90
/* istanbul ignore next */
89
- Result . install = function ( Vue ) {
90
- Vue . use ( Base ) ;
91
- Vue . component ( Result . name , Result ) ;
91
+ Result . install = function ( app ) {
92
+ app . component ( Result . name , Result ) ;
92
93
} ;
93
94
export default Result ;
0 commit comments