【发布时间】:2022-01-11 16:24:42
【问题描述】:
我是 Vue 新手,正在处理 Vue 应用程序上的一些遗留代码,我不确定为什么我的图像没有加载到页面上。 我知道我的组件到资产的路径是正确的,因为我有一个扩展程序可以在我的代码中显示图像,并且它们出现在那里。
我觉得问题源于这里...... 这是在我的 vue.config.js 文件中的:
chainWebpack: (config) => {
config.module
.rule("vue")
.use("vue-loader")
.loader("vue-loader")
.tap((options) => {
options.transformAssetUrls = {
img: "src",
image: "xlink:href",
"b-avatar": "src",
"b-img": "src",
"b-img-lazy": ["src", "blank-src"],
"b-card": "img-src",
"b-card-img": "src",
"b-card-img-lazy": ["src", "blank-src"],
"b-carousel-slide": "img-src",
"b-embed": "src",
};
return options;
});
},
};```
I built my app from Vue CLI so it should have come built in with Webpack and vue-loader, right?
Are there any other dependancies that need to be added separately for this to function?
Any help is appreciated, thanks!
【问题讨论】:
标签: vue.js webpack assets vue-loader