Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.6k views
in Technique[技术] by (71.8m points)

uni.previewImage的预览图片问题

<template>
     
        
     
        <view class="">
            <view class="" v-for="(item,index) in photos" :key="index" >
                <navigator :src="item.src" @click="previewImage(index)">111111111111111111</navigator>
                <image :src="item.src" @click="previewImage(index)"></image>
            </view>
        </view>
     
</template>

<script>
    export default {
        data(){
            return {
                photos:[
                   {src:'/static/logo.png'}
                ]
            }
        },
        methods: {
            // 预览图片
            previewImage(index) {
                let photoList = this.photos.map(item => {
                    return item.src;
                });
                uni.previewImage({
                    current: index,     // 当前显示图片的链接/索引值
                    urls: photoList,    // 需要预览的图片链接列表,photoList要求必须是数组
                    loop:true   // 是否可循环预览
                });
            },
         }
         
    }
</script>

<style>
    
</style>

image

点开图片预览就是这样 。。。。。加载不出来 求解


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

我可以告诉你的是,我把你的代码复制到我的项目中,可以正常预览。
你的具体换交不太清楚,可以尝试将url替换为远程连接试试,以及制家传递url测试。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...