vue3-lazy 的使用
#### Install
npm install vue3-lazy -S
#### 引入 main.js
demo:
import { createApp } from 'vue'
import App from './app'
import lazyPlugin from 'vue3-lazy'
const app = createApp(App)
app.use(lazyPlugin, {
loading: 'loading.png',
error: 'error.png'
})
app.mount('#app')
实例:
createApp(App).use(store).use(router).use(lazyPlugin, {
loading: require('@/assets/images/default.png')
})
#### 使用
<ul>
<li v-for="img in list">
<img v-lazy="img.src" >
</li>
</ul>
越努力越幸运