<template>
<div class="ue-exception">
<div class="ue-exception-icon" v-if="icon">
<slot name="icon">
<img :src="getSrc" />
</slot>
</div>
<div class="ue-exception-content">
<h5 class="ue-exception-title" v-if="getTitle">{{ getTitle }}</h5>
<p class="ue-exception-desc" v-if="getDesc">{{ getDesc }}</p>
<slot></slot>
</div>
</div>
</template>
<script>
export default {
props: {
type: {
default: 'noFound',
type: String,
validator (value) {
return [
'noData',
'development',
'authority',
'noFound',
'busys',
'gateway'
].indexOf(value) > -1
}
},
title: {
type: String,
default: ''
},
desc: {
type: String,
default: ''
},
iconUrl: {
type: String,
default: ''
},
icon: {
type: Boolean,
default: true
}
},
data () {
return {
}
},
computed: {
getTitle () {
const { type, title } = this
return title || this.$t('common.exception.' + type + '.title')
},
getDesc () {
const { type, desc } = this
return desc || this.$t('common.exception.' + type + '.desc')
},
getSrc () {
const { type, iconUrl } = this
return iconUrl || this.$t('common.exception.' + type + '.iconUrl')
}
}
}
</script>
<style lang="scss">
.ue-exception {
margin: 0 auto;
text-align: center;
.ue-exception-icon {
margin: 0 auto;
text-align: center;
width: 350px;
padding: 20px 0 40px;
}
.ue-exception-content {
.ue-exception-title {
padding: 0 0 20px;
}
.ue-exception-desc {
padding: 0 0 20px;
}
}
}
</style>
console