html页面渲染缩略图

    <el-table-column label="缩略图片" min-width="50%">
            <template slot-scope="scope">
                <el-popover placement="right" title="" trigger="hover">
                    <img :src="scope.row.picPath" />
                    <img slot="reference" :src="scope.row.picPath" style="max-height: 50px;max-width: 130px">
                </el-popover>
            </template>
        </el-table-column>

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在 Nuxt 项目中使用 Swiper 缩略图控制可以通过以下步骤实现: 1. 安装 Swiper 和 Swiper Vue 模块: ```bash npm install swiper swiper/vue ``` 2. 在 `nuxt.config.js` 中引入 Swiper 样式: ```js css: [ 'swiper/css/swiper.css' ], ``` 3. 在需要使用 Swiper 的页面中引入 Swiper 和 Swiper Vue 组件: ```vue <template> <div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide" v-for="(item, index) in list" :key="index"> <img :src="item.image" /> </div> </div> <div class="swiper-pagination"></div> </div> <div class="swiper-container-thumbnails"> <div class="swiper-wrapper"> <div class="swiper-slide" v-for="(item, index) in list" :key="index"> <img :src="item.image" /> </div> </div> </div> </template> <script> import { Swiper, SwiperSlide } from 'swiper/vue'; import SwiperCore, { Pagination, Thumbs } from 'swiper/core'; SwiperCore.use([Pagination, Thumbs]); export default { components: { Swiper, SwiperSlide, }, data() { return { list: [ { image: 'https://dummyimage.com/600x400/000/fff', }, { image: 'https://dummyimage.com/600x400/000/fff', }, { image: 'https://dummyimage.com/600x400/000/fff', }, ], }; }, mounted() { const swiper = new Swiper('.swiper-container', { loop: true, pagination: { el: '.swiper-pagination', clickable: true, }, thumbs: { swiper: { el: '.swiper-container-thumbnails', slidesPerView: 3, spaceBetween: 10, }, }, }); }, }; </script> ``` 4. 根据需求自定义样式。 上述代码中,我们使用了 `Swiper`、`SwiperSlide`、`Pagination` 和 `Thumbs` 组件,其中 `Swiper` 和 `SwiperSlide` 是 Swiper Vue 官方提供的组件,`Pagination` 和 `Thumbs` 是 Swiper 的核心模块。在 `mounted` 钩子函数中,我们初始化了一个 Swiper 实例,并配置了循环播放、分页器以及缩略图。其中缩略图的配置项 `swiper` 对应的是缩略图 Swiper 实例的配置项,我们可以根据需求自行设置。在 HTML 中,我们分别定义了一个 Swiper 容器和一个缩略图容器,并通过 `v-for` 循环渲染。需要注意的是,两个容器的类名不能重复,并且需要在 Swiper 实例的配置项中正确引用。 最后,我们可以根据需求自定义 Swiper 和缩略图容器的样式,例如修改容器宽度、高度、背景色等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值