Vant引入CDN实现图片懒加载


<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Documenttitle>
    <link rel="stylesheet" href="https://cdn.suoluomei.com/common/js2.0/npm/[email protected]/lib/index.css">
head>
<style>
    img {
        width: 100%;
        height: 100%;
    }
style>

<body>
    <div class="box">
        <div class="img" v-for="(item,index) in imgList" :key="index">
            <img v-lazy="item">
        div>
    div>
body>
<script src="https://cdn.suoluomei.com/common/js2.0/vue/v2.5.16/vue.js">script>
<script src="https://cdn.suoluomei.com/common/js2.0/npm/[email protected]/lib/vant.min.js">script>
<script>
    Vue.use(vant.Lazyload, {
        lazyComponent: true
    });
    new Vue({
        el: '.box',
        data: {
            imgList: ['https://sucai.suoluomei.cn/sucai_zs/images/20200521092752-1.png',
                'https://sucai.suoluomei.cn/sucai_zs/images/20200521092752-1.png',
                'https://sucai.suoluomei.cn/sucai_zs/images/20200521092752-1.png',
                'https://sucai.suoluomei.cn/sucai_zs/images/20200521092752-1.png',
                'https://sucai.suoluomei.cn/sucai_zs/images/20200521092752-1.png']
        }
    })
script>

html>

你可能感兴趣的:(Module)