vue获取ajax数据并动态渲染

2021年12月15日1 min read
vue

实例

var app = new Vue({  
    el: "#app",  
    data: {  
        res: []  
    }  
})  
$(function () {  
    $('.carousel').carousel({  
        interval: 5000  
    })  
});  
//查询content banner  
window.onload = function () {  
    $.ajax({  
        url: '',  
        method: "GET",  
        success(res) {  
            app.res = res;  
            return res;  
        }  
    });  
};
<div class="item" v-for="(image,index) in res">  
    <img :src="image.cover" data-holder-rendered="true">  
</div>