<template>

<div>
    <van-nav-bar class="nav-bar" title="Detail" >
        <template #left>
            <van-icon name="arrow-left" color="#fff" @click="back()" />
        </template>
    </van-nav-bar>

    <div class="imgBanner">
        <van-swipe :autoplay="null" :initial-swipe="nowIndex" indicator-color="white" style="height: 100%;">
            <van-swipe-item v-for="(item, index) in imgs" :key="index">
                <van-image :src="fullImgUrl(item)" width="100%" height="100%" fit="cover" />
            </van-swipe-item>
        </van-swipe>
    </div>
</div>


</template>


<script>
import { nowLocationUrl } from '@/utils/tools';
export default{
    data(){
        return{
            imgs:[],
            nowIndex:null
        }
    },
    mounted(){
        const q = this.$route.query.data;
        if (!q) return;
        try {
            this.imgs = JSON.parse(decodeURIComponent(atob(q)));
        } catch { this.imgs = []; }

        this.nowIndex = this.$route.query.nowIndex
        // console.log('显示吧:',this.imgs)
    },
    methods:{
        fullImgUrl(imgUrl){
            return nowLocationUrl + imgUrl
        },
        back(){
            this.$router.back()
        }
    }

}
</script>


<style lang="scss" scoped>
.imgBanner{
    width: 100%;
    align-items: center;
    height: 100vh;
}
</style>