Vue动态加载图片图片不显示

图片是放在assets文件夹下的

使用require进行解决

图片不显示的原因

在webpack,将图片放在assets中,会将图片图片来当做模块来用,因为是动态加载的,所以url-loader将无法解析图片地址,

<el-table-column label="照片">
        <template slot-scope="scope">
          <i class="el-icon-picture-outline" @click="showPhoto(scope.row)"></i>
          <img id="aa" :src="scope.row.img" />
        </template>
</el-table-column>
 {
          date: "2016-05-02",
          studentId: "201319981010",
          name: "王2虎",
          className: "高2018级2班",
          img: require("../../../assets/image/wearther.png"), //引号中括号里面哦
          address: "区金沙江路 1518 弄"
        },

猜你喜欢

转载自www.cnblogs.com/IwishIcould/p/11946283.html