简体   繁体   English

如何在 BootstrapVue 轮播中包含图像?

[英]How do I include image in BootstrapVue carousel?

I am trying to add an image to the img-src="" attribute of b-carousel in BoostrapVue.我正在尝试将图像添加到 BoostrapVue 中 b-carousel 的img-src=""属性。 The image is currently saved in the asset folder.图像当前保存在资产文件夹中。

 <b-carousel-slide img-src="../assets/life.jpg"> <h1>Hello world!</h1> </b-carousel-slide>

在此处输入图像描述

I have added Find below images of the result:我添加了在下面的结果图像中查找: 在此处输入图像描述

I am certain the images are correctly saved in the right location:我确定图像已正确保存在正确的位置: 在此处输入图像描述

If using a loader with webpack (ie vue-loader, url-loader, etc), you need to ensure that the loader knows that img-src accepts a URL.如果使用带有 webpack 的加载器(即 vue-loader、url-loader 等),您需要确保加载器知道img-src接受 URL。

See the docs on information on how to tell the loaders to handle URL props on custom components: https://bootstrap-vue.js.org/docs/reference/images (specifically Vue Loader transformAssetUrls )有关如何告诉加载程序处理自定义组件上的 URL 道具的信息,请参阅文档: https://bootstrap-vue.js.org/docs/reference/images (特别是 Vue Loader transformAssetUrls

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM