<template>
    <view v-if="visible" class="share-guide-mask" @click="closeGuide">
        <view class="guide-content">
            <image class="guide-arrow" :src="arrowImage" mode=""></image>
            <view v-for="(text, index) in textArray" :key="index" class="guide-text">
                {{ text }}
            </view>
        </view>
    </view>
</template>

<script>
export default {
    props: {
        value: {
            type: Boolean,
            default: false
        },
        text: {
            type: [String, Array],
            default: '点击右上角"..."选择"分享到朋友圈"'
        },
        arrowImage: {
            type: String,
            default: '/static/share-arrow.png'
        }
    },
    computed: {
        visible: {
            get() {
                return this.value;
            },
            set(val) {
                this.$emit('input', val);
            }
        },
        textArray() {
            if (Array.isArray(this.text)) {
                return this.text;
            }
            return [this.text];
        }
    },
    methods: {
        closeGuide() {
            this.visible = false;
            this.$emit('close');
        }
    }
}
</script>

<style scoped>
.share-guide-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.guide-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 100rpx;
    padding-right: 60rpx;
}

.guide-arrow {
    width: 100rpx;
    height: 160rpx;
    animation: arrow-up 1s infinite alternate;
}

.guide-text {
    font-size: 32rpx;
    color: #FFFFFF;
    font-weight: bold;
    margin-bottom: 10rpx;
    text-align: center;
}

@keyframes arrow-up {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-15rpx);
    }
}
</style>