【问题标题】:Vuetify- image Load failedVuetify-图像加载失败
【发布时间】:2019-12-28 15:01:17
【问题描述】:

我想要做的是在页面上显示图像。我已将其路径存储在后端(MySQL)中,并在获取后将其放入 <v-img> 的 src 中,但发生错误时说-

[Vuetify] Image load failed

src: userImage

found in

---> <VImg>
       <Anonymous>
         <VContent>
           <VApp>
             <App> at src/App.vue
               <Root>

编辑 - 这是我的 Profile.js 文件

<template>
<v-container >
      <div class="headline">Your Profile</div>
      <br><br>
      <div class="title">Username-</div>
      <v-text-field
      v-model="user.username"
      placeholder="Username"
      required
    ></v-text-field>
    <div class="title">Password-</div>
    <v-text-field
      v-model="user.password"
      placeholder="Password"
      required
    ></v-text-field>
    <div class="title">Avatar-</div>
    <v-img
      v-bind:src="userImage"
      aspect-ratio="1"
      class="grey lighten-2"
      max-width="150"
      max-height="150"
    ></v-img>
    <div class="title">Email-</div>
    <v-text-field
      v-model="user.email"
      placeholder="Email"
      required
    ></v-text-field>

</v-container>
</template>

【问题讨论】:

  • 你需要显示一些代码,而不仅仅是错误信息......
  • 对不起..
  • 数据呢? userImage 的值是多少?
  • userImage 的值为=uploaded_images\users\main-thumb-394688203-200-tbjppbxdlfloldogbcqrvmrkwoxgnpom.jpeg
  • 我们说的就是这个DEV环境吗?这张图片在服务器上吗?

标签: vue.js vuejs2 vue-component vuex vuetify.js


【解决方案1】:

确保绑定src属性:&lt;v-image v-bind:src="userImage" /&gt;

如您所见herehere,该消息是由浏览器本身引发的onerror 事件生成的,因此这意味着图像 URL 有问题(带有此 URL 的图像不在服务器上)。检查呈现的 URL,尝试复制它并在浏览器中打开...

【讨论】:

  • 你好@杰克。你是如何解决这个问题的。我也有同样的问题
猜你喜欢
  • 2020-07-25
  • 2020-07-30
  • 2020-05-03
  • 1970-01-01
  • 2020-06-24
  • 1970-01-01
  • 2020-07-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多