一定要将静态资源引入 【 require("@/assets/") 】,绑定到 模型绑定的:src 数据中 动态的数据才能有效
 
<template>
  <div>
     <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>动态列表</span>
        <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
      </div>
      
      <div class="list">
        <el-table
          ref="multipleTable"
          :data="dataPicture"
          tooltip-effect="dark"
          style="width: 100%"
          @selection-change="handleSelectionChange">
          
          <el-table-column
            type="selection"
            width="55">
          </el-table-column>
          <el-table-column
            label="用户"
            width="120">
            <template slot-scope="scope">{{  (scope.row.user).username }}</template>
          </el-table-column>
          <el-table-column
            label="内容"
            width="220">
            <template slot-scope="scope">{{ scope.row.body }}</template>
          </el-table-column>
          <el-table-column
            label="图片"
            width="220">
           
            <template slot-scope="scope">
             <div v-for="(img, index) in scope.row.imgArr" :key="index">
                <img :src="getImgUrl(img.path)" alt="" class="img">
             </div>
            </template>
          </el-table-column>
          <el-table-column
            label="时间"
            width="220">
            <template slot-scope="scope">{{ scope.row.date }}</template>
          </el-table-column>
          <el-table-column
            label="操作"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
              <el-button type="text" size="small">编辑</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-card>
 </div>
</template>
<script>
export default {
  data() {
    return {
      dataPicture:[],
    }
  },
  methods: {
    handleClick(row) {
      console.log(row);
    },
    handleSelectionChange(val) {
      // console.log(val);
      this.multipleSelection = val;
    },
    getImgUrl(icon){
      return require("@/assets/"+icon);
    }
  },
  async created() {
    var res = await this.$http.get('/picture')
    this.dataPicture = res.data
    // console.log(typeof this.dataPicture[0].user);
  },
}
</script>
<style scoped>
.img{
  width: 100px;
  height: 100px;
}
</style>

vue :src 不显示的解决方案的更多相关文章

  1. Vue项目部署问题及解决方案

    Vue项目部署问题及解决方案 Vue-Router 有两种模式,默认是 hash 模式,另外一种是 history 模式. hash:也就是地址栏里的 # 符号.比如 http://www.examp ...

  2. 直接用<img> 的src属性显示base64转码后的字符串成图片

    直接用<img> 的src属性显示base64转码后的字符串成图片 <img src="base64转码后的字符串" ></img> 下面的图片 ...

  3. JSP 中文乱码显示处理解决方案

    来源: <http://blog.csdn.net/joyous/article/details/1504274> JSP 中文乱码显示处理解决方案 分类: 所有 Web前端 J2EE20 ...

  4. 直接用<img> 的src属性显示base64转码后的字符串成图片【原】

    直接用<img> 的src属性显示base64转码后的字符串成图片 <img src="data:image/gif;base64,base64转码后的字符串" ...

  5. g++编译后中文显示乱码解决方案(c++)

    g++编译后中文显示乱码解决方案   环境:Windows 10 专业版 GCC版本:5.3.0 测试代码: 1 #include <iostream> 2 using namespace ...

  6. MYSQL 命令行显示乱码 解决方案

    中文乱码是因为编码集不支持,所以要改变编码 先查看下设置的编码 使用如下命令 show variables like 'character%'; 在 mysql.conf (Ubuntu mysql5 ...

  7. vue打包后显示空白正确处理方法

    vue打包后显示空白正确处理方法是 1.找到配置文件(js与css加载不上) 修改 这样打包处理可以打开但是页面样式会找不到 2.修改(针对css中的图片加载不上) 找到对应的位置加上publicPa ...

  8. SVN 客户端不显示图标解决方案

    下图为没有设置之前,文件夹不显示svn图标 SVN客户端不显示图标解决方案:右键svn->设置->图标覆盖->状态缓存选择"Windows外壳"->确定,刷 ...

  9. [转]Vue 2.0——渐进式前端解决方案

    前言:框架是什么?为什么要有框架?在众多的框架之中,Vue 独具魅力之处在哪里呢?其背后的核心思想是什么?Vue 究竟火到什么程度?最近发布的 Vue2.0 又做了哪些改进呢?Vue 和 Weex 又 ...

随机推荐

  1. 验证码校验(Ajax)

    show.jsp <%@ page language="java" contentType="text/html; charset=utf-8" page ...

  2. SpringBoot下配置Druid

    什么是Druid:Druid是阿里发开的一套基于database的监控平台,相对于其他监控来说对于中文的支持更亲民.. 前言:最近这段时间发现项目整体运行响应速度较慢,打算对系统进行深层次的优化(尤其 ...

  3. Python - 代码片段,Snippets,Gist

    说明 代码片段来自网上搬运的或者自己写的 华氏温度转摄氏温度 f = float(input('请输入华氏温度: ')) c = (f - 32) / 1.8 print('%.1f华氏度 = %.1 ...

  4. 动态代理Cglib

    jar包 <!-- https://mvnrepository.com/artifact/cglib/cglib --><dependency> <groupId> ...

  5. 【剑指Offer面试编程题】题目1507:不用加减乘除做加法--九度OJ

    题目描述: 写一个函数,求两个整数之和,要求在函数体内不得使用+.-.*./四则运算符号. 输入: 输入可能包含多个测试样例. 对于每个测试案例,输入为两个整数m和n(1<=m,n<=10 ...

  6. C语言入门---第九章 C语言指针

    没学指针就是没学C语言! 指针是C语言的精华,也是C语言的难点. 所谓指针,也就是内存的地址,所谓指针变量,也就是保存了内存地址的变量.不过人们往往不会区分两者的概念,而是混淆在一起使用. ===== ...

  7. CCF认证201909-4推荐系统

    #include <iostream> #include <list> #include <set> #include <vector> using n ...

  8. 9.2.3 hadoop reduce端连接-分区分组聚合

    1.1.1         reduce端连接-分区分组聚合 reduce端连接则是利用了reduce的分区功能将stationid相同的分到同一个分区,在利用reduce的分组聚合功能,将同一个st ...

  9. mybatis typealias 问题

    最近在学mybatis  在一个简单的问题上却花了挺长时间 网上也没发现有类似的案例 故记录一下 在configuration里面 typealias 和 properties 同时用会出错 具体原因 ...

  10. 一道快速考察 Python 基础的面试题

    这是前一阵子群友发在群里的一道面试题,利用 Python 字典的特性,可以巧妙地使用精简代码达成完美解. 题目 将 data 转换成 new_data 这种形式,写出转换过程. data = { 'a ...