use-lazyload-in-vue-ssr

Found a article about image lazyload in Nuext.js Nuxt.js使用lazyload - kobe - 博客园

I don’t use Nuxt in my ssr project, so it’s a little different

Add vue-lazyload

1
yarn add vue-lazyload

Use vue-lazyload before creating Vue App

1
2
3
4
5
// entry-client.js
import VueLazyload from 'vue-lazyload'

Vue.use(VueLazyload)
const { app, router, store } = createApp()

*Codes in entry-client file will execute in browser env

Then in component

1
v-lazy="img.image_big_url"

原文作者: dgb8901,yinxing

原文链接: https://www.itwork.club/2019/03/18/use-lazyload-in-vue-ssr/

版权声明: 转载请注明出处

为您推荐

体验小程序「简易记账」

关注公众号「特想学英语」

企业微信服务商开发(一)