p***@vip.qq.com
p***@vip.qq.com
  • 发布:2019-07-10 10:02
  • 更新:2019-07-10 10:07
  • 阅读:2338

image 不能显示图片 :src无效

分类:uni-app

我遇到多次这个问题了,我看社区里面也有很多人遇到这个问题 但是一直没有人回复解决
<image class="uni-product-image" src="http://39.108.12.195:9012//static/_image/posttask/20190710/86b6c386aad14ed1ae54a2fc992622ee.jpg"></image>
我直接使用 src绑定一个绝对地址 是没有问题
但是一旦使用 :src动态读取 一样的网络地址就不显示图片
<image class="uni-product-image" :src="getimage()"></image>

getimage 方法就是返回 上上面的网络地址 这样是不显示图片 pc端预览的时候是没有问题 打包成 app在手机端就不行
getimage(src) {
return 'http://39.108.12.195:9012//static/_image/posttask/20190710/86b6c386aad14ed1ae54a2fc992622ee.jpg';
}

以下是我当前组件的全部代码

<template>
<view class="uni-product-list">
<view class="uni-product" v-for="(product,index) in productList" :key="index" @click="gotodec(product.Id)">
<image class="uni-product-image" src="http://39.108.12.195:9012//static/_image/posttask/20190710/86b6c386aad14ed1ae54a2fc992622ee.jpg"></image>
<view class="image-view">
<image class="uni-product-image" :src="getimage(product.GoodCoveImage)"></image>
</view>
<view class="uni-product-title">{{product.GoodName}}</view>
<view class="uni-product-price">
<view class="tag-view">
<uni-tag :text="'+'+product.VipDay+'天'" type="success" size="small"></uni-tag>
</view>
<br>
<text class="uni-product-price-original">已售{{product.GoodStock}}</text>
<text class="uni-product-tip">¥{{product.GoodPrice}}</text>
</view>
</view>
</view>
</template>

<script>
import kx from "@/common/kx"
import uniTag from '@/components/uni-tag/uni-tag.vue'
export default {
components: {
uniTag
},
data() {
return {
title: 'product-list',
//productList: [],
renderImage: false
};
},
props: {
productList: Array
},
methods: {
loadData(action = 'add') {

        },  
        gotodec(id) {  
            this.$emit('proclick', id)  
        },  
        getimage() {  
            return 'http://39.108.12.195:9012//static/_image/posttask/20190710/86b6c386aad14ed1ae54a2fc992622ee.jpg';  
        },  
    }  
};  

</script>

<style>
/ product /

</style>

2019-07-10 10:02 负责人:无 分享
已邀请:
p***@vip.qq.com

p***@vip.qq.com (作者)

望解决

该问题目前已经被锁定, 无法添加新回复