Result 结果
用于反馈一系列操作任务的处理结果。
何时使用
当有重要操作需告知用户处理结果,且反馈内容较为复杂时使用。
代码演示
成功的结果。
<template>
<a-result
status="success"
title="Successfully Purchased Cloud Server ECS!"
sub-title="Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait."
>
<template #extra>
<a-button key="console" type="primary">Go Console</a-button>
<a-button key="buy">Buy Again</a-button>
</template>
</a-result>
</template>
展示处理结果。
<template>
<a-result title="Your operation has been executed">
<template #extra>
<a-button key="console" type="primary">Go Console</a-button>
</template>
</a-result>
</template>
警告类型的结果。
<template>
<a-result status="warning" title="There are some problems with your operation.">
<template #extra>
<a-button key="console" type="primary">Go Console</a-button>
</template>
</a-result>
</template>
你没有此页面的访问权限。
<template>
<a-result status="403" title="403" sub-title="Sorry, you are not authorized to access this page.">
<template #extra>
<a-button type="primary">Back Home</a-button>
</template>
</a-result>
</template>
此页面未找到。
<template>
<a-result status="404" title="404" sub-title="Sorry, the page you visited does not exist.">
<template #extra>
<a-button type="primary">Back Home</a-button>
</template>
</a-result>
</template>
服务器发生了错误。
<template>
<a-result status="500" title="500" sub-title="Sorry, the server is wrong.">
<template #extra>
<a-button type="primary">Back Home</a-button>
</template>
</a-result>
</template>
复杂的错误反馈。
<template>
<a-result
status="error"
title="Submission Failed"
sub-title="Please check and modify the following information before resubmitting."
>
<template #extra>
<a-button key="console" type="primary">Go Console</a-button>
<a-button key="buy">Buy Again</a-button>
</template>
<div class="desc">
<p style="font-size: 16px">
<strong>The content you submitted has the following error:</strong>
</p>
<p>
<close-circle-outlined :style="{ color: 'red' }" />
Your account has been frozen
<a>Thaw immediately ></a>
</p>
<p>
<close-circle-outlined :style="{ color: 'red' }" />
Your account is not yet eligible to apply
<a>Apply Unlock ></a>
</p>
</div>
</a-result>
</template>
<script lang="ts">
import { CloseCircleOutlined } from '@ant-design/icons-vue';
import { defineComponent } from 'vue';
export default defineComponent({
components: {
CloseCircleOutlined,
},
});
</script>
<style scoped>
.desc p {
margin-bottom: 1em;
}
</style>
自定义 icon。
<template>
<a-result title="Great, we have done all the operations!">
<template #icon>
<smile-twoTone />
</template>
<template #extra>
<a-button type="primary">Next</a-button>
</template>
</a-result>
</template>
<script lang="ts">
import { SmileTwoTone } from '@ant-design/icons-vue';
import { defineComponent } from 'vue';
export default defineComponent({
components: {
SmileTwoTone,
},
});
</script>
API
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
title | title 文字 | string | VNode | #title | - |
subTitle | subTitle 文字 | string | VNode | #subTitle | - |
status | 结果的状态,决定图标和颜色 | ‘success’ | ‘error’ | ‘info’ | ‘warning’| ‘404’ | ‘403’ | ‘500’ | ‘info’ |
icon | 自定义 icon | #icon | - |
extra | 操作区 | #extra | - |