如何在 Vue3 + Parcel 2 中粘贴插入本地图像?

问题描述

我想使用项目中本地文件夹中的图像 (fitlogo.png)。

如果我使用 Vue 3 + ParcelJS 2 怎么办?

注意:第一张图片(通过网址从网络加载) - 一切OK

第二个图片 - 我看到了替代文字


这是 App.vue 中的代码

<template>
  <div class="container">
    <h1>{{ message }}</h1>
    <img :src="roseImg" alt="no Image!">
    <img :src="import(roseImg2)" alt="no Local Image!"> <!-- HOW ??-->
  </div>
</template>

<script>
export default {
  name: 'App',data() {
    return {
      message: 'Using Parcel In A Vue.js App',roseImg: 'https://img-fotki.yandex.ru/get/5807/136160416.205/0_15fa25_b38668a9_orig.png',roseImg2: '/fitlogo.png',};
  },};
</script>

这是 package.json 的一部分:

"main": "index.html","scripts": {
    "dev": "parcel index.html","test": "echo \"Error: no test specified\" && exit 1"
  },

这是我看到的

what i see

============================================

这是文件-文件夹结构:

project structure

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)