Home >Web Front-end >JS Tutorial >How to use the picture magnifying glass plug-in in vue2.x?

How to use the picture magnifying glass plug-in in vue2.x?

亚连
亚连Original
2018-06-11 10:51:302927browse

This article mainly introduces the use of the e-commerce picture magnifying glass plug-in based on vue2.x. Now I will share it with you and give you a reference.

Recently I was working on an e-commerce website. There was a need to put the mouse on the main image to display the image magnifying glass effect like Taobao product details page. After searching, it seemed that there was no suitable vue plug-in, so I masturbated one myself and wanted to share it. It's Xiaobai's first time to share, and all the masters should not laugh.

vue-piczoom

picture magnifier component for Vue.js 2.x

E-commerce picture magnifier plug-in based on vue2.x

GIF animated screenshot

##Build Setup usage steps

# 安装 install
npm install vue-piczoom --save

use use

--script

import PicZoom from 'vue-piczoom'
export default {
 name: 'App',
 components: {
 PicZoom
 }
}

--html

<pic-zoom url="static/imac2.jpg" :scale="3"></pic-zoom>

Config configuration

propsdescribedefaulturlPicture addressstring required## big-urlscalescroll
Big picture address string null
Picture magnification number 2.5
Whether the page can be scrolled when zoomed in boolean fasle
Suggest Notes

The component defaults to 100% height and width, so it is recommended to include the component in a container with fixed height and width. For example:

<pic-zoom url="static/imac2.jpg" :scale="3"></pic-zoom>

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to achieve forward refresh and backward non-refresh effect in vue

In Vue2.5 through Table and How does the Pagination component implement the paging function

How to integrate Bootstrap 4 in Laravel?

How to get the option value in the select tag in jquery

How to dynamically add option to select using js (detailed tutorial)

Connecting to MySQL in nodejs (detailed tutorial)

How to achieve seamless scrolling effect using vue.js

Use routing in vue to implement page refresh

jQuery implements recursive infinite layer function

The above is the detailed content of How to use the picture magnifying glass plug-in in vue2.x?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn