<template>
    <view :class="{'am-popup': true, 'className': className, 'am-popup-show': show, 'animation': animation}">
        <view class="am-popup-mask" v-if="mask" @click="onMaskTap" :style="'z-index: ' + zIndex"></view>
        <view class="am-popup-content am-popup-bottom" :style="'z-index: ' + zIndex"><slot></slot></view>
    </view>
</template>

<script>
export default {
    props: {
        className: {
            type: String,
            default: ''
        },
        show: {
            type: Boolean,
            default: false
        },
        position: {
            type: String,
            default: 'bottom'
        },
        mask: {
            type: Boolean,
            default: true
        },
        animation: {
            type: Boolean,
            default: true
        },
        disableScroll: {
            type: Boolean,
            default: true
        }
    },
    data() {
        return {
            zIndex: 10000
        }
    },
    methods: {
        onMaskTap () {
            this.$emit('onClose')
        }
    }
}
</script>

<style lang="less" scoped>
@import './popup.less';
</style>
