123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <view class="tui-landscape__box">
- <view class="tui-landscape__inner" :style="{zIndex:zIndex}" v-if="show">
- <slot></slot>
- <view class="tui-icon__close"
- :style="{top:position!=1?iconTop:'auto',bottom:position==1?iconBottom:'auto',left:position==3?iconLeft:(position==1?'50%':'auto'),right:position==2?iconRight:'auto'}"
- :class="{'tui-icon__bottom':position==1}" v-if="closeIcon" @tap.stop="close">
- <icon type="clear" :color="iconColor" :size="iconSize"></icon>
- </view>
- </view>
- <view :style="{backgroundColor:maskBgColor,zIndex:maskZIndex}" @tap.stop="close(1)" class="tui-landscape__mask"
- :class="{'tui-mask_hidden':!show}" v-if="mask"></view>
- </view>
- </template>
- <script>
- export default {
- name: "tui-landscape",
- emits: ['close'],
- props: {
-
- show: {
- type: Boolean,
- default: false
- },
-
- zIndex: {
- type: Number,
- default: 1001
- },
-
- closeIcon: {
- type: Boolean,
- default: true
- },
-
- iconColor: {
- type: String,
- default: '#fff'
- },
-
- iconSize: {
- type: Number,
- default: 25
- },
-
- position: {
- type: [Number, String],
- default: 1
- },
-
- iconTop: {
- type: String,
- default: '-120rpx'
- },
-
- iconBottom: {
- type: String,
- default: '-120rpx'
- },
-
- iconLeft: {
- type: String,
- default: '0'
- },
-
- iconRight: {
- type: String,
- default: '0'
- },
-
- maskClosable: {
- type: Boolean,
- default: true
- },
-
- mask: {
- type: Boolean,
- default: true
- },
-
- maskBgColor: {
- type: String,
- default: 'rgba(0,0,0,.6)'
- },
-
- maskZIndex: {
- type: Number,
- default: 1000
- },
-
- params: {
- type: [Number, String],
- default: 0
- }
- },
- methods: {
- close(isMask) {
- if (isMask == 1 && !this.maskClosable) return;
- this.$emit('close', {
- params: this.params
- });
- }
- }
- }
- </script>
- <style scoped>
- .tui-landscape__box {
- width: 100%;
- box-sizing: border-box;
- overflow: hidden;
- }
- .tui-landscape__inner {
- max-width: 100%;
- position: fixed;
- box-sizing: border-box;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- }
- .tui-icon__close {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- position: absolute;
- z-index: 10;
- }
- .tui-icon__bottom {
- left: 50% !important;
- transform: translateX(-50%);
- }
- .tui-landscape__mask {
- position: fixed;
- z-index: 1000;
- top: 0;
- right: 0;
- left: 0;
- bottom: 0;
- opacity: 1;
- transform: scale3d(1, 1, 1);
- transition: all .2s ease-in
- }
- .tui-mask_hidden {
- opacity: 0 !important;
- transform: scale3d(1, 1, 0) !important;
- }
- </style>
|