Result 结果 (版本: 1.5.0+)
用于反馈一系列操作任务的处理结果。
何时使用
当有重要操作需告知用户处理结果,且反馈内容较为复杂时使用。
代码演示
Success
成功的结果。
<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>
<script>
export default {
data() {
return {};
},
};
</script>
Warning
警告类型的结果。
<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>
<script>
export default {
data() {
return {};
},
};
</script>
404
此页面未找到。
<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>
<script>
export default {
data() {
return {};
},
};
</script>
Error
复杂的错误反馈。
<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>
<a-icon :style="{ color: 'red' }" type="close-circle" /> Your account has been frozen
<a>Thaw immediately ></a>
</p>
<p>
<a-icon :style="{ color: 'red' }" type="close-circle" /> Your account is not yet eligible to
apply <a>Apply Unlock ></a>
</p>
</div>
</a-result>
</template>
<script>
export default {
data() {
return {};
},
};
</script>
<style scoped>
.desc p {
margin-bottom: 1em;
}
</style>
Info
展示处理结果。
<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>
<script>
export default {
data() {
return {};
},
};
</script>
403
你没有此页面的访问权限。
<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>
<script>
export default {
data() {
return {};
},
};
</script>
500
服务器发生了错误。
<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>
<script>
export default {
data() {
return {};
},
};
</script>
自定义 icon
自定义 icon。
<template>
<a-result title="Great, we have done all the operations!">
<template #icon>
<a-icon type="smile" theme="twoTone" />
</template>
<template #extra>
<a-button type="primary">
Next
</a-button>
</template>
</a-result>
</template>
<script>
export default {
data() {
return {};
},
};
</script>
API
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
title | title 文字 | string | VNode | v-slot:title | - |
subTitle | subTitle 文字 | string | VNode | v-slot:subTitle | - |
status | 结果的状态,决定图标和颜色 | ‘success’ | ‘error’ | ‘info’ | ‘warning’| ‘404’ | ‘403’ | ‘500’ | ‘info’ |
icon | 自定义 icon | v-slot:icon | - |
extra | 操作区 | v-slot:extra | - |