mand-mobile/components/result-page/index.vue

125 lines
2.5 KiB
Vue
Raw Permalink Normal View History

2018-03-26 16:04:04 +08:00
<template>
2018-09-14 16:03:24 +08:00
<div class="md-result">
2018-11-24 18:29:28 +08:00
<div class="md-result-image">
<img :src="actualImgUrl" :class="!imgUrl && type"/>
</div>
<div class="md-result-text" v-if="actualText">{{actualText}}</div>
<div class="md-result-subtext" v-if="actualSubText">{{actualSubText}}</div>
2018-09-14 16:03:24 +08:00
<div class="md-result-buttons" v-if="buttons.length">
2018-03-26 16:04:04 +08:00
<md-button
v-for="(button, index) of buttons"
2018-08-29 14:47:06 +08:00
:type="button.type"
:plain="button.plain === undefined || button.plain"
:round="button.round"
:inactive="button.inactive"
:loading="button.loading"
:icon="button.icon"
:icon-svg="button.iconSvg"
2018-08-29 14:47:06 +08:00
size="small"
inline
2018-03-26 16:04:04 +08:00
:key="index"
@click="button.handler">
2018-03-26 16:04:04 +08:00
{{button.text}}
</md-button>
</div>
</div>
</template>
<script> import {t} from '../_locale'
import Button from '../button'
2018-03-26 16:04:04 +08:00
export default {
name: 'md-result-page',
components: {
[Button.name]: Button,
},
props: {
type: {
type: String,
default: 'empty',
},
imgUrl: {
type: String,
default: '',
},
text: {
type: String,
default: '',
},
subtext: {
type: String,
default: '',
},
buttons: {
type: Array,
default() {
return []
},
},
},
computed: {
actualImgUrl() {
const pre = '//manhattan.didistatic.com/static/manhattan/mand-mobile/result-page/2.1/'
return this.imgUrl || `${pre}${this.type}.png`
},
actualText() {
return (
2018-03-26 16:04:04 +08:00
this.text ||
{
// 网络连接异常
network: t('md.result_page.networkError'),
2018-03-26 16:04:04 +08:00
// 暂无信息
empty: t('md.result_page.noInformation'),
}[this.type] ||
''
)
},
actualSubText() {
return (
this.subtext ||
{
// 您要访问的页面已丢失
lost: t('md.result_page.lostWay'),
}[this.type] ||
''
)
},
2018-03-26 16:04:04 +08:00
},
}
</script>
<style lang="stylus">
2018-09-14 16:03:24 +08:00
.md-result
2018-03-26 16:04:04 +08:00
display flex
align-items center
justify-content center
flex-direction column
width 100%
height 100%
text-align center
2018-11-24 18:29:28 +08:00
.md-result-image
width result-page-image-size
img
width 100%
margin-bottom 40px
2018-03-26 16:04:04 +08:00
2018-09-14 16:03:24 +08:00
.md-result-text
margin 20px 20px 0
2018-09-14 16:03:24 +08:00
color result-page-title-color
font-size result-page-title-font-size
2018-03-26 16:04:04 +08:00
2018-09-14 16:03:24 +08:00
.md-result-subtext
margin-top 16px
2018-09-14 16:03:24 +08:00
color result-page-describe-color
font-size result-page-describe-font-size
2018-03-26 16:04:04 +08:00
2018-09-14 16:03:24 +08:00
.md-result-buttons
display flex
.md-button
margin 10px
2018-03-26 16:04:04 +08:00
</style>