Vuetify-图像加载失败

时间:2019-12-28 15:01:17

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

我要做的是在页面上显示图像。我已将其路径存储在backend(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>

1 个答案:

答案 0 :(得分:0)

确保绑定src属性:<v-image v-bind:src="userImage" />

如您所见herehere,该消息是由浏览器自身引发的onerror事件产生的,因此,这意味着图片URL出现了问题(此网址不在服务器上)。检查呈现的URL,尝试将其复制并在浏览器中打开...