Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Vue渲染V-for内的图像_Javascript_Image_Vue.js - Fatal编程技术网

Javascript Vue渲染V-for内的图像

Javascript Vue渲染V-for内的图像,javascript,image,vue.js,Javascript,Image,Vue.js,我试图在v-for中渲染一个图像,但我只能将其捕获为字符串 <tr class="bg-gray-100 border-b border-gray-200" v-for="currentView in getDashboard()" :key="currentView.id" > <td class="px-4 py-3">

我试图在v-for中渲染一个图像,但我只能将其捕获为字符串

  <tr
      class="bg-gray-100 border-b border-gray-200"
      v-for="currentView in getDashboard()"
      :key="currentView.id"
    >
      <td class="px-4 py-3">
        <img :src=" {{currentView["avatarUrl"]}}" width="40px" />
      </td>


{{currentView[“avatarUrl”]}}是一个对象,该索引包含化身图像。以这种方式使用img标记会显示语法错误。通过其他方式,对于img源标记内的对象,我如何访问v-for。

:src=“currentView.avatarUrl”
或:src=“{currentView['avatarUrl']}”它不工作。什么也没有呈现。我读到我必须通过一个函数添加require,但它也不工作。对不起。它现在起作用了。我真的不知道为什么,但以“currentView.avatarUrl”的形式访问它现在似乎工作正常。非常感谢<代码>:src=“currentView['avatarUrl']”