Vue Lazy SVG image
use SVGs as a placeholder for lazy loading images.
install
yarn install vue-lazy-svg-image
import Vue from 'vue'import LazySvgImage from 'vue-lazy-svg-image' Vue.use(LazySvgImage)
// SVGs should be imported with vue-svg-loader to import inline svgs<LazySvgImage svg="svgfile" image="path/to/image"><LazySvgImage>
css
// .lazy-transition (Vue transition) controls the image's transition when its ready // by default the scss left blank (this is just an example) .lazy-transition-enter, .lazy-transition-leave .lazy-transition-enter-active, .lazy-transition-leave-to // .lazy-svg uses animation to animate the svg's path // .lazy-image is the image class .lazy-svg, .lazy-image .lazy-svg .lazy-image
Todo
- make more versatile
- alternative svg loading options?