Files
aurora-admin/frameworks/ExceptionVariants.vue2.vue
T

41 lines
1.5 KiB
Vue

<template>
<div class="aa-exception">
<div class="aa-exception-emoji">{{ resolved.emoji }}</div>
<div class="aa-exception-title">{{ resolved.title }}</div>
<div class="aa-exception-desc" v-if="resolved.desc">{{ resolved.desc }}</div>
<div class="aa-exception-actions">
<button class="aa-exception-btn primary" @click="$emit('home')">返回首页</button>
<button class="aa-exception-btn" @click="$emit('retry')">重试</button>
</div>
</div>
</template>
<script>
export default {
name: 'AaExceptionVariants',
props: {
type: { type: String, default: '404' },
emoji: { type: String, default: '' },
title: { type: String, default: '' },
desc: { type: String, default: '' }
},
computed: {
resolved: function () {
var p = {
'403': { emoji: '🔒', title: '403 禁止访问', desc: '抱歉,你没有权限访问此页面。' },
'404': { emoji: '🔍', title: '404 页面不存在', desc: '你访问的页面已被移除或从未存在。' },
'500': { emoji: '⚙️', title: '500 服务器错误', desc: '服务器开小差了,请稍后再试。' },
'502': { emoji: '🔌', title: '502 网关错误', desc: '网关无响应,请检查网络后重试。' }
}[this.type] || {};
return {
emoji: this.emoji || p.emoji || '⚠️',
title: this.title || p.title || '出错了',
desc: this.desc || p.desc || ''
};
}
}
};
</script>
<style src="./ExceptionVariants.css"></style>