do lazy loading with vue-lazyload, install
npm install vue-lazyload-- save-dev
first according to the tutorial. I have a problem here, that is, after installation, vue-lazyload appears in devDependencies rather than in dependencies.
devDependencies is not supposed to be used in the development phase and will not appear after packaging, but according to my understanding, this plug-in should not be used through-- save appears in dependencies?
my project directory is created through vuecli scaffolding
in main.js
import VueLazyload from "vue-lazyload" //
Vue.use(VueLazyload, {
preLoad: 1.3,
error: "../static/img/unload.jpg",
loading: "../static/img/unload.jpg",
attempt: 1
})
in the index.vue used (index.vue is located in src/page/index.vue):
v-for:
<img :v-lazy="single.pic_cover" alt="">
/* <img :src"single.pic_cover" alt="">*//src
the actual rendered result v-lazy does not seem to be valid. If it does, it should be rendered as src
.<img v-lazy="../../static/img/m1.png" alt="">
/ / I really can"t find out where the problem is. Please take a look at it. Thank you first
. < hr > just found that the problem v-lazy does not need to be used as a binding attribute. Delete the binding:
so what"s left about devDependencies and dependencies,
Why didn"t you install VueLazyload into dependencies through-- save? ~
Thank you again