所以最后两张图片没有显示在我的网站上,这些图片位于src/assets/images文件夹中.我错过了什么?

<template>
  <section id="projects" class="project-section">
    <v-container>
      <v-row>
        <v-col>
          <h1>Projects</h1>
        </v-col>
      </v-row>
      <v-row class="justify-space-around">
        <v-card
          v-for="project in projects"
          :key="project.name"
          max-width="300px"
        >{{ project.image }}
          <v-img class="align-end" width="200" :src="project.image" />
          <v-card-title>{{ project.name }}</v-card-title>
          <v-card-subtitle class="pb-0"> {{ project.tech }}: </v-card-subtitle>

          <v-card-text class="text--primary">
            <div>{{ project.description }}</div>
          </v-card-text>

          <v-card-actions>
            <v-btn color="orange" text :href="project.github">
              Github Repo
            </v-btn>

            <v-btn color="orange" text :href="project.url">
              Live
            </v-btn>
          </v-card-actions>
        </v-card>
      </v-row>
    </v-container>
  </section>
</template>

<script>
export default {
  name: "Projects",
  data() {
    return {
      projects: [
        {
          name: "Twitch24",
          github: "https://github.com/badbabykosh/twitch24",
          url: "https://twitchtv-81469.firebaseapp.com/",
          tech: "Javascript ES5, requireJS, Bootstrap",
          description:
            "Experimental app built with qunit, pure javascript, AMD module design and requireJS with Bootstrap. Launch it. Select you favorite channels and see when they are online.",
          image: "https://new-thefonso.vercel.app/img/portfolio/fullsize/twitch24.png",
        },
        {
          name: "Pomodoro",
          github: "https://github.com/badbabykosh/pomodoro",
          url: "http://pomodoro.s3-website-us-west-1.amazonaws.com/",
          tech: "React, Bootstrap",
          description:
            "Experimental application utilizing the D3 and jquery libraries and the Bootstrap framework. Launch it in a new window and play with it for fun. Take a look at the code on github",
          image: "https://new-thefonso.vercel.app/img/portfolio/fullsize/fonsodoro.png",
        },
        {
          name: "Cox Auto Prism",
          github: "",
          url: "https://prs-demo.netlify.com/",
          tech: "React, GraphQL, GatsbyJS, React-strap",
          description:
            "Production application built in React. It's purpose is to demo each React component built for the system. PRISM is a React component library style guide. The library is meant to harmonize look and feel across all cox auto properties.",
          image: "https://new-thefonso.vercel.app/img/portfolio/fullsize/prism_big.png",
        },
        {
          name: "3D Demo 1",
          github: "",
          url: "https://unclefonso-3d-demo-uecg.vercel.app/",
          tech: "React, Spline",
          description:
            "A design created in Figma and ported over to 3D and presented inside a React app for demo purposes.",
          image: "@/assets/images/figma3d.png",
        },
        {
          name: "Covid Tracker",
          github: "",
          url: "https://vue-covid-tracker-theta.vercel.app/",
          tech: "Vue 3, external API",
          description:
            "Experimental api consumer demo. An exercise to explore Vue 3 capabilities.",
          image: "@/assets/images/covid_tracker.png",
        },
      ],
    };
  },
};
</script>

<style scoped>
.project-section {
  background-color: #d8c593;
}
.v-image {
  border-bottom: #708160 1px solid;
}
</style>

网络选项卡显示:"Get http://localhost:8082/@/assets/images/figma3d.png 404(未找到)"

推荐答案

src文件夹中的图像不会自动发布.您不能简单地引用src文件夹中的文件.然而,有几种方法可以克服这一点.

Use the public folder.public个文件夹中的所有内容都将包括在您的应用程序中,因此如果您将assets文件夹移动到那里,您可以将其称为./assets.

<img src="./assets/images/figma3d.png">

如果这是一个复杂的应用程序,我建议设置根路径,以便引用每个图像或字体等,无论当前URL是什么,都将从域发起.

<base href="/">

更多信息

Vue.js相关问答推荐

V-img不显示文件夹中的图像

VUE:带自定义组件的数组输入绑定

如何在 Nuxt3 中使用 nuxtjs/auth-next 模块?

Vuetify 扩展面板,面板标题左侧带有图标

Webpack 导入的模块不是函数

将props传递给设置时的VueJS 3组合API和TypeScript类型问题:类型上不存在属性 user用户

使用 jquery-chosen 插件更新 vuejs 模型值

在 vue 组件中检索配置和环境变量

Vue.js 从模板中分离样式

错误:您可能需要额外的加载器来处理这些加载器的结果.

重新加载发布到 Github 页面的 Vue 网站时出现 404

如何使用 vuejs 从 SPA 访问 /storage -laravel- 中的图像

vue-router的router-link实际刷新?

如何使用 vue.js 获取所选选项的索引

Vue.js:TypeError:无法设置只有 getter 的 # 的属性props

如何在 vue.js 2 上循环对象观察者?

从子组件 Vue 更新父模型

升级到 vue-cli 3 后,HTML 中的空格消失了

Vuetify 离线文档

这个业务逻辑有多少属于 Vuex?