2018-03-26 16:04:04 +08:00
|
|
|
<template>
|
2018-08-30 16:47:41 +08:00
|
|
|
<div class="md-landscape" :class="{'is-full': fullScreen}">
|
2018-03-26 16:04:04 +08:00
|
|
|
<md-popup
|
|
|
|
|
v-model="isLandscapeShow"
|
2018-04-24 11:35:02 +08:00
|
|
|
:mask-closable="maskClosable"
|
2018-03-26 16:04:04 +08:00
|
|
|
prevent-scroll
|
2018-11-13 18:31:22 +08:00
|
|
|
prevent-scroll-exclude=".md-landscape-content"
|
2018-08-30 16:47:41 +08:00
|
|
|
:has-mask="!fullScreen && hasMask"
|
2019-12-26 10:51:59 +08:00
|
|
|
:transition="transition"
|
2018-03-26 16:04:04 +08:00
|
|
|
@input="$emit('input', false)"
|
|
|
|
|
@show="$emit('show')"
|
|
|
|
|
@hide="$emit('hide')">
|
2018-11-13 18:31:22 +08:00
|
|
|
<div class="md-landscape-body" :class="{scroll}">
|
|
|
|
|
<div class="md-landscape-content">
|
|
|
|
|
<slot></slot>
|
|
|
|
|
</div>
|
|
|
|
|
<md-icon
|
|
|
|
|
class="md-landscape-close"
|
|
|
|
|
:class="{dark: !hasMask || fullScreen}"
|
|
|
|
|
@click="$_close"
|
|
|
|
|
:name="fullScreen ? 'clear' : 'close'"
|
|
|
|
|
/>
|
2018-03-26 16:04:04 +08:00
|
|
|
</div>
|
|
|
|
|
</md-popup>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
import Popup from '../popup'
|
|
|
|
|
import Icon from '../icon'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'md-landscape',
|
|
|
|
|
|
|
|
|
|
components: {
|
|
|
|
|
[Popup.name]: Popup,
|
|
|
|
|
[Icon.name]: Icon,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
props: {
|
|
|
|
|
value: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
scroll: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2018-08-30 16:47:41 +08:00
|
|
|
fullScreen: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2018-03-26 16:04:04 +08:00
|
|
|
hasMask: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
2018-04-24 11:35:02 +08:00
|
|
|
maskClosable: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
2019-12-26 10:51:59 +08:00
|
|
|
transition: {
|
|
|
|
|
type: String,
|
|
|
|
|
default() {
|
|
|
|
|
return this.fullScreen ? 'md-fade' : 'md-punch'
|
|
|
|
|
},
|
|
|
|
|
},
|
2018-03-26 16:04:04 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
isLandscapeShow: this.value,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
|
value(val) {
|
|
|
|
|
this.isLandscapeShow = val
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
// MARK: private methods
|
|
|
|
|
$_close() {
|
|
|
|
|
this.isLandscapeShow = false
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="stylus">
|
|
|
|
|
.md-landscape
|
2018-08-30 16:47:41 +08:00
|
|
|
&.is-full
|
2018-09-28 15:37:15 +08:00
|
|
|
.md-popup-box
|
|
|
|
|
position absolute
|
2018-08-30 16:47:41 +08:00
|
|
|
absolute-pos()
|
2018-11-13 18:31:22 +08:00
|
|
|
.md-landscape-body
|
|
|
|
|
width 100%
|
|
|
|
|
height 100%
|
2018-08-30 16:47:41 +08:00
|
|
|
background landscape-fullscreen-bg
|
2018-11-13 18:31:22 +08:00
|
|
|
.md-landscape-content
|
2018-08-30 16:47:41 +08:00
|
|
|
width 100%
|
|
|
|
|
height 100%
|
2018-11-13 18:31:22 +08:00
|
|
|
overflow auto
|
|
|
|
|
-webkit-overflow-scrolling touch
|
|
|
|
|
.md-icon.md-landscape-close
|
|
|
|
|
position absolute
|
|
|
|
|
right 25px
|
|
|
|
|
top 25px
|
|
|
|
|
margin auto
|
2018-08-30 16:47:41 +08:00
|
|
|
|
2018-11-13 19:55:57 +08:00
|
|
|
.md-popup, .md-popup-box
|
2018-08-30 16:47:41 +08:00
|
|
|
z-index landscape-zindex
|
|
|
|
|
|
2018-11-13 18:31:22 +08:00
|
|
|
.md-icon.md-landscape-close
|
2018-03-26 16:04:04 +08:00
|
|
|
position relative
|
2018-11-13 18:31:22 +08:00
|
|
|
display block
|
|
|
|
|
margin 50px auto 20px auto
|
|
|
|
|
font-size 50px
|
|
|
|
|
width 50px
|
|
|
|
|
height 50px
|
|
|
|
|
line-height 50px
|
2018-03-26 16:04:04 +08:00
|
|
|
text-align center
|
|
|
|
|
color color-text-base-inverse
|
|
|
|
|
&.dark
|
|
|
|
|
color color-text-base
|
2018-11-13 18:31:22 +08:00
|
|
|
opacity 0.5
|
|
|
|
|
|
|
|
|
|
.md-landscape-content
|
|
|
|
|
width landscape-width
|
|
|
|
|
font-size font-body-large
|
|
|
|
|
overflow auto
|
|
|
|
|
-webkit-overflow-scrolling touch
|
|
|
|
|
box-sizing border-box
|
|
|
|
|
img
|
|
|
|
|
max-width 100%
|
|
|
|
|
height auto
|
2018-03-26 16:04:04 +08:00
|
|
|
</style>
|