1.首先下载PicZoom插件

npm install vue-piczoom --save

2.使用时注意:原来img标签要改为pic-zoom,并且属性src要改为url

html部分代码:

<template><div><div class="box"><pic-zoom :url="imgurl" :scale="3"></pic-zoom></div><div class="list"><ul><li v-for="(item,index) in imagesList" :key="index" @mouseenter="changeImage(index)"><img :src="item" /></li></ul></div></div>
</template>

js部分代码:(1)引入PicZoom

(2)如果使用的图片是本地图片,则要加上require来引入。

  import PicZoom from "vue-piczoom"
<script>import PicZoom from "vue-piczoom"export default {name: "FooterShow",data(){return{imgurl:require("../assets/images/pic1.jpg"),imagesList:[require("../assets/images/pic1.jpg"),require("../assets/images/pic2.jpg"),require("../assets/images/pic3.jpg"),]}},components:{PicZoom},methods:{changeImage:function (index) {this.imgurl=this.imagesList[index];}}}
</script>

css部分代码:

<style scoped>
.box{width: 400px;height: 320px;
}
.list{width: 400px;height: 130px;
}.list ul{width: 400px;display: flex;justify-content: space-around;}.list ul li{width:120px;height: 90px;background-color: white;margin-top: 15px;}.list ul li img{width: 120px;height: 90px;}
</style>

这样就可以作为成一个组件来使用了。

效果图:

vue仿淘宝放大镜插件的使用相关推荐

  1. vue仿淘宝放大镜插件 vue-piczoom的使用问题

    vue仿淘宝放大镜插件 vue-piczoom npm install vue-piczoom--save //下载放大镜插件 使用的话就是直接引入 import picZoom from 'vue- ...

  2. 淘宝放大镜插件(vue-piczoom)

    Build Setup 使用步骤 # 安装 install npm install vue-piczoom --save # 使用 use --script import PicZoom from ' ...

  3. Vue 仿淘宝购物车

    效果图: 我们只是做演示,其中的数据应该从后台来取得,这里我们模拟几条数据来显示. 页面布局: <div id="shop_car"><section class ...

  4. 用vue仿淘宝商品筛选

    css略,点击牛仔裤添加到已选条件,点击x取消选择 <!DOCTYPE html> <html lang="en"> <head><met ...

  5. vue仿淘宝京东商品多条件筛选(vue实现)

    <template><div id="warp">你选择的是:<mark v-for="(item,index) in arr"& ...

  6. vue仿淘宝结账订单

    <template>   <div class= "container" >   <div class= "checkout-title&q ...

  7. vue仿淘宝购物车的实现

    先看效果图 实现的功能有: 1.选中店铺,店铺下的商品全选中 2.店铺下的商品全选中,相对应的店铺也会被选中 3.所有的店铺全选中,底部的全选也会被选中 4.所有的商品全选中,底部的全选也会被选中 5 ...

  8. 高仿淘宝分页:jQuery分页插件kkpager-Array-专题视频课程

    高仿淘宝分页:jQuery分页插件kkpager-503人已学习 课程介绍         天底下万能的分页 课程收益     让所有人不再为分页所苦恼 讲师介绍     Array 更多讲师课程   ...

  9. js仿淘宝主图放大镜功能

    js仿淘宝主图放大镜功能 演示地址 下载地址

最新文章

  1. 计算机及网络应用基础思维导图_思维导图在生物教学中的应用
  2. 程序员面试金典 - 面试题 03.05. 栈排序(两栈)
  3. 系统新模块增加需要哪些步骤_想要吸引人流,儿童乐园需要增加哪些新设备呢...
  4. 信数金服:决策模型的迭代
  5. npm设置http代理
  6. django,cbv,模板层
  7. gcc预处理、编译、汇编、链接详解
  8. 微信小程序热潮或渐趋冷静
  9. NCE4 L6 The sporting spirit
  10. ssh 所选的用户密钥未在远程主机上注册
  11. 机器学习——神经网络(三):线性神经网络
  12. Float浮动与清除浮动
  13. C++17 结构化绑定
  14. 《日瓦戈医生》读后感
  15. 二分查找的左右逼近法
  16. 一个简单的PHP笔试题
  17. ESP8266占空比测试
  18. 开发游戏需要什么知识
  19. 深度学习这么调参训练_深度学习调参技巧
  20. Mac如何显示完整英文路径

热门文章

  1. The Farthest Distance in the World (Tagore)
  2. python的matmul_numpy中dot()、outer()、multiply()以及matmul()的区别
  3. 阿雪的学习记录|图像特征基础
  4. centos7 默认中文字体_Linux CentOS 7 安装字体库 中文字体
  5. P4001 [ICPC-Beijing 2006]狼抓兔子(ISAP模板题)
  6. 利用360tools-master进行计算S-PSNR,CPP-PSNR,WS-PSNR
  7. MySql 天数转时间(yyyymmdd), CST (格林威尔时间转) yyyymmdd , java
  8. 基于Java的数据交换整合平台V2.0更新了
  9. 甲骨文对MySQL的策略
  10. 猎豹移动:公有云快速构建海外移动化应用基础环境