diff --git a/components/result/index.jsx b/components/result/index.tsx
similarity index 84%
rename from components/result/index.jsx
rename to components/result/index.tsx
index a0e5c91df..0c48df53b 100644
--- a/components/result/index.jsx
+++ b/components/result/index.tsx
@@ -1,5 +1,6 @@
-import { inject } from 'vue';
+import { App, defineComponent, inject, VNodeTypes } from 'vue';
import PropTypes from '../_util/vue-types';
+import { tuple } from '../_util/type';
import { getComponent } from '../_util/props-util';
import { defaultConfigProvider } from '../config-provider';
import CheckCircleFilled from '@ant-design/icons-vue/CheckCircleFilled';
@@ -29,13 +30,15 @@ const ExceptionStatus = Object.keys(ExceptionMap);
export const ResultProps = {
prefixCls: PropTypes.string,
icon: PropTypes.any,
- status: PropTypes.oneOf(['success', 'error', 'info', 'warning', '404', '403', '500']).def('info'),
+ status: PropTypes.oneOf(tuple('success', 'error', 'info', 'warning', '404', '403', '500')).def(
+ 'info',
+ ),
title: PropTypes.any,
subTitle: PropTypes.any,
extra: PropTypes.any,
};
-const renderIcon = (prefixCls, { status, icon }) => {
+const renderIcon = (prefixCls: string, { status, icon }) => {
if (ExceptionStatus.includes(`${status}`)) {
const SVGComponent = ExceptionMap[status];
return (
@@ -49,9 +52,10 @@ const renderIcon = (prefixCls, { status, icon }) => {
return
{iconNode}
;
};
-const renderExtra = (prefixCls, extra) => extra && ;
+const renderExtra = (prefixCls: string, extra: VNodeTypes) =>
+ extra && ;
-const Result = {
+const Result = defineComponent({
name: 'AResult',
props: ResultProps,
setup() {
@@ -59,7 +63,7 @@ const Result = {
configProvider: inject('configProvider', defaultConfigProvider),
};
},
- render(h) {
+ render() {
const { prefixCls: customizePrefixCls, status } = this;
const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('result', customizePrefixCls);
@@ -79,7 +83,7 @@ const Result = {
);
},
-};
+});
/* add resource */
Result.PRESENTED_IMAGE_403 = ExceptionMap[403];
@@ -87,8 +91,9 @@ Result.PRESENTED_IMAGE_404 = ExceptionMap[404];
Result.PRESENTED_IMAGE_500 = ExceptionMap[500];
/* istanbul ignore next */
-Result.install = function(app) {
+Result.install = function(app: App) {
app.component(Result.name, Result);
return app;
};
+
export default Result;
diff --git a/components/result/noFound.jsx b/components/result/noFound.tsx
similarity index 89%
rename from components/result/noFound.jsx
rename to components/result/noFound.tsx
index 7c8e15967..dddcfe108 100644
--- a/components/result/noFound.jsx
+++ b/components/result/noFound.tsx
@@ -4,7 +4,7 @@ const NoFound = () => {
-
+
{
{
{
{
{
{
/>
{
{
diff --git a/components/result/serverError.jsx b/components/result/serverError.tsx
similarity index 89%
rename from components/result/serverError.jsx
rename to components/result/serverError.tsx
index 505e6c2b3..986da2b41 100644
--- a/components/result/serverError.jsx
+++ b/components/result/serverError.tsx
@@ -5,7 +5,7 @@ const ServerError = () => {
-
+
{
{
/>
{
{
{
{
{
{
{
{
return (