Skip to content

结果 Result

用于反馈一系列操作任务的处理结果

何时使用

  • 当有重要操作需告知用户处理结果,且反馈内容较为复杂时使用

成功的结果

Successfully Purchased Cloud Server ECS!
Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait.
Go Console
Buy Again
Show Code
vue
<template>
  <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>
      <Button key="console" type="primary">Go Console</Button>
      <Button key="buy">Buy Again</Button>
    </template>
  </Result>
</template>

展示处理结果

Your operation has been executed
Go Console
Show Code
vue
<template>
  <Result title="Your operation has been executed">
    <template #extra>
      <Button key="console" type="primary">Go Console</Button>
    </template>
  </Result>
</template>

警告类型的结果

There are some problems with your operation.
Go Console
Show Code
vue
<template>
  <Result status="warning" title="There are some problems with your operation.">
    <template #extra>
      <Button key="console" type="primary">Go Console</Button>
    </template>
  </Result>
</template>

复杂的错误反馈

Submission Failed
Please check and modify the following information before resubmitting.
Go Console
Buy Again

The content you submitted has the following error:

Your account has been frozen Thaw immediately >

Your account is not yet eligible to apply Apply Unlock >

Show Code
vue
<script setup lang="ts">
import { CloseCircleOutlined } from '@ant-design/icons-vue'
</script>
<template>
  <Result
    status="error"
    title="Submission Failed"
    sub-title="Please check and modify the following information before resubmitting."
  >
    <template #extra>
      <Button key="console" type="primary">Go Console</Button>
      <Button key="buy">Buy Again</Button>
    </template>
    <div class="desc">
      <p style="font-size: 16px">
        <strong>The content you submitted has the following error:</strong>
      </p>
      <p>
        <CloseCircleOutlined style="font-size: 14px; color: #ff4d4f" />
        Your account has been frozen
        <a>Thaw immediately &gt;</a>
      </p>
      <p>
        <CloseCircleOutlined :style="{ fontSize: '14px', color: '#ff4d4f' }" />
        Your account is not yet eligible to apply
        <a>Apply Unlock &gt;</a>
      </p>
    </div>
  </Result>
</template>
<style lang="less" scoped>
.desc p {
  margin-bottom: 1em;
  line-height: 1;
}
</style>

403 你没有此页面的访问权限

403
Sorry, you are not authorized to access this page.
Back Home
Show Code
vue
<template>
  <Result status="403" title="403" sub-title="Sorry, you are not authorized to access this page.">
    <template #extra>
      <Button type="primary">Back Home</Button>
    </template>
  </Result>
</template>

404 此页面未找到

404
Sorry, the page you visited does not exist.
Back Home
Show Code
vue
<template>
  <Result status="404" title="404" sub-title="Sorry, the page you visited does not exist.">
    <template #extra>
      <Button type="primary">Back Home</Button>
    </template>
  </Result>
</template>

500 服务器发生了错误

500
Sorry, the server is wrong.
Back Home
Show Code
vue
<template>
  <Result status="404" title="404" sub-title="Sorry, the page you visited does not exist.">
    <template #extra>
      <Button type="primary">Back Home</Button>
    </template>
  </Result>

  ## 500 服务器发生了错误

  <Result status="500" title="500" sub-title="Sorry, the server is wrong.">
    <template #extra>
      <Button type="primary">Back Home</Button>
    </template>
  </Result>
</template>

自定义 Icon

Great, we have done all the operations!
Next
Show Code
vue
<script setup lang="ts">
import { SmileTwoTone } from '@ant-design/icons-vue'
</script>
<template>
  <Result title="Great, we have done all the operations!">
    <template #icon>
      <SmileTwoTone />
    </template>
    <template #extra>
      <Button type="primary">Next</Button>
    </template>
  </Result>
</template>

APIs

Result

参数说明类型默认值
icon自定义图标slotundefined
status结果的状态,决定图标和颜色'success' | 'error' | 'info' | 'warning' | '404' | '403' | '500''info'
title标题文字string | slotundefined
subTitle副标题文字string | slotundefined
extra额外内容string | slotundefined

Released under the MIT License.