Vue表格操作图片切换 点击查看大图 实现循环左右切换

本文介绍如何在Vue项目中,于表格操作中实现图片点击放大,并提供循环左右切换的功能。通过注册组件,展示清晰易懂的代码示例,帮助开发者自定义样式并扩展更多功能,如图片缩放。
摘要由CSDN通过智能技术生成

在Vue 表格操作中实现图片切换 点击大图实现循环切换
首先在你的表格columns增加这个组件

{
   
 	title: this.$t("detail"),
  	width:200,
    render: (h, param) => {
   
      return h(
        "div",
        {
    style: {
    padding: "6px 0", display: "flex" } }, 
        	[ h(marQuee, {
   
            props: {
   
              pictureKey:  param.row.pictures,//图片的地址多个为数组
              width: 40,//在操作栏里的宽度
              height: 40,//在操作栏里的高度
            }
          })
        ]
      );
    }
 }

记得注册这个组件哈!

下面直接上组件非常清晰明了

<template>
  <div class="wrap">
    <!-- 表格操作的切换 -->
    <Icon
      type="ios-arrow-back"
      class="arrowLeft"
      @click="arrowL"
      v-if="this.pictureKey.length -3 > 0"
      :title="this.fisrtlist?`${$t('fisrtImage')}`:`${offsetCount+1}/${this.pictureKey.length}`"
    />
    <div class="wrapImage">
      <div class="imgList" ref="imgList">
        <img
          :src="`${getUrl(value)}?width=${width}&height=${height}`"
          v-for="(value,index) in pictureKey"
          :key="index"
          :width="width"
          :height="height"
          @click="bigImg(currentImage,index)"
          :title="`${$t('howmany').replace('%s',index+1)}`"
        >
      </div>
    </div>
    <Icon
      type="ios-arrow-forward"
      class="arrowRight"
      @click
  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值