Result结果 - 图1

Result 结果 (版本: 1.5.0+)

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

何时使用

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

代码演示

Result结果 - 图2

Success

成功的结果。

  1. <template>
  2. <a-result
  3. status="success"
  4. title="Successfully Purchased Cloud Server ECS!"
  5. sub-title="Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait."
  6. >
  7. <template #extra>
  8. <a-button key="console" type="primary">
  9. Go Console
  10. </a-button>
  11. <a-button key="buy">
  12. Buy Again
  13. </a-button>
  14. </template>
  15. </a-result>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {};
  21. },
  22. };
  23. </script>

Result结果 - 图3

Warning

警告类型的结果。

  1. <template>
  2. <a-result status="warning" title="There are some problems with your operation.">
  3. <template #extra>
  4. <a-button key="console" type="primary">
  5. Go Console
  6. </a-button>
  7. </template>
  8. </a-result>
  9. </template>
  10. <script>
  11. export default {
  12. data() {
  13. return {};
  14. },
  15. };
  16. </script>

Result结果 - 图4

404

此页面未找到。

  1. <template>
  2. <a-result status="404" title="404" sub-title="Sorry, the page you visited does not exist.">
  3. <template #extra>
  4. <a-button type="primary">
  5. Back Home
  6. </a-button>
  7. </template>
  8. </a-result>
  9. </template>
  10. <script>
  11. export default {
  12. data() {
  13. return {};
  14. },
  15. };
  16. </script>

Result结果 - 图5

Error

复杂的错误反馈。

  1. <template>
  2. <a-result
  3. status="error"
  4. title="Submission Failed"
  5. sub-title="Please check and modify the following information before resubmitting."
  6. >
  7. <template #extra>
  8. <a-button key="console" type="primary">
  9. Go Console
  10. </a-button>
  11. <a-button key="buy">
  12. Buy Again
  13. </a-button>
  14. </template>
  15. <div class="desc">
  16. <p style="font-size: 16px;">
  17. <strong>The content you submitted has the following error:</strong>
  18. </p>
  19. <p>
  20. <a-icon :style="{ color: 'red' }" type="close-circle" /> Your account has been frozen
  21. <a>Thaw immediately &gt;</a>
  22. </p>
  23. <p>
  24. <a-icon :style="{ color: 'red' }" type="close-circle" /> Your account is not yet eligible to
  25. apply <a>Apply Unlock &gt;</a>
  26. </p>
  27. </div>
  28. </a-result>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {};
  34. },
  35. };
  36. </script>
  37. <style scoped>
  38. .desc p {
  39. margin-bottom: 1em;
  40. }
  41. </style>

Result结果 - 图6

Info

展示处理结果。

  1. <template>
  2. <a-result title="Your operation has been executed">
  3. <template #extra>
  4. <a-button key="console" type="primary">
  5. Go Console
  6. </a-button>
  7. </template>
  8. </a-result>
  9. </template>
  10. <script>
  11. export default {
  12. data() {
  13. return {};
  14. },
  15. };
  16. </script>

Result结果 - 图7

403

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

  1. <template>
  2. <a-result status="403" title="403" sub-title="Sorry, you are not authorized to access this page.">
  3. <template #extra>
  4. <a-button type="primary">
  5. Back Home
  6. </a-button>
  7. </template>
  8. </a-result>
  9. </template>
  10. <script>
  11. export default {
  12. data() {
  13. return {};
  14. },
  15. };
  16. </script>

Result结果 - 图8

500

服务器发生了错误。

  1. <template>
  2. <a-result status="500" title="500" sub-title="Sorry, the server is wrong.">
  3. <template #extra>
  4. <a-button type="primary">
  5. Back Home
  6. </a-button>
  7. </template>
  8. </a-result>
  9. </template>
  10. <script>
  11. export default {
  12. data() {
  13. return {};
  14. },
  15. };
  16. </script>

Result结果 - 图9

自定义 icon

自定义 icon。

  1. <template>
  2. <a-result title="Great, we have done all the operations!">
  3. <template #icon>
  4. <a-icon type="smile" theme="twoTone" />
  5. </template>
  6. <template #extra>
  7. <a-button type="primary">
  8. Next
  9. </a-button>
  10. </template>
  11. </a-result>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {};
  17. },
  18. };
  19. </script>

API

参数说明类型默认值
titletitle 文字string | VNode | v-slot:title-
subTitlesubTitle 文字string | VNode | v-slot:subTitle-
status结果的状态,决定图标和颜色‘success’ | ‘error’ | ‘info’ | ‘warning’| ‘404’ | ‘403’ | ‘500’‘info’
icon自定义 iconv-slot:icon-
extra操作区v-slot:extra-