<template>
    <view class="detail">
        <template v-if="type === 'video'">
            <video :src="videoUrl"></video>
        </template>
        <template v-else>
            <image :src="adsImage" mode="widthFix" show-menu-by-longpress></image>
        </template>
    </view>
</template>

<script>
export default {
    data() {
        return {
            adsImage: '',
            videoUrl: '',
            title: '',
            type: ''
        }
    },
    onLoad(option) {
        this.title = option.title
        this.type = option.type || 'image'
        if (this.type === 'video') {
            this.videoUrl = option.videoUrl
        } else {
            this.adsImage = option.adsImage
        }
        if (this.title && this.title !== 'null') {
            uni.setNavigationBarTitle({ title: this.title })
        }
    }
}
</script>

<style lang="scss">
.detail {
    width: 100%;
    height: auto;
    image {
        width: 100%;
        height: auto;
    }
    video {
        width: 100vw;
        height: 100vh;
        background: #999;
    }
}
</style>
