Home  >  Article  >  Web Front-end  >  Introduction to the Vue-based lazy loading plug-in vue-view-lazy

Introduction to the Vue-based lazy loading plug-in vue-view-lazy

不言
不言Original
2018-07-04 11:54:181780browse

This article mainly introduces the lazy loading plug-in vue-view-lazy based on Vue, which can load pictures or other resources after entering the visible area. The content is quite good. I will share it with you now and give it as a reference. .

Lazy loading plug-in based on vue

Purpose: Load pictures or other resources after entering the visible area

Install and use

  1. Directly download vue-view-lazy.min.js in the dist directory and use

  2. Install using npm

Use directly

npm:

$ npm install --save-dev vue-view-lazy

Introducing vue-view-lazy

.main file

import vView from 'vue-view-lazy'
Vue.use(vView,{
  error:'../../static/images/loading.png',
  loading:'../../static/images/loading.gif',
});

Lazy loading of pictures

.vue file




Lazy loading data

.vue file





The above is the entire content of this article, I hope it will be helpful Everyone’s learning is helpful. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Method to implement button-level permission control based on Vue custom instructions

Introduction to vue component name

The above is the detailed content of Introduction to the Vue-based lazy loading plug-in vue-view-lazy. 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