Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vue-preload-img

yanggwcn9ISC0.0.2

vue预加载图片插件

vue, preload, plugin

readme

vue预加载插件

功能:在mounted钩子中,加载需要预加载的图片。

使用方法:

  1. 引入
import VuePreLoadImg from 'vue-preload-img'
  1. 使用
Vue.use(VuePreLoadImg, {
  key: 'myKey', // 默认是预加载配置项的key是'VUE_PRELOAD_IMG_CONFIG'
})
  1. 在data中加入要预加载的图片地址,如:
data() {
  return {
    // ...
    VUE_PRELOAD_IMG_CONFIG: {
      delay: 1000, // 延迟毫秒数
      data: [
          '图片1.png''图片2.png''图片3.png'
        ]
    }
  }
}