NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <script src="https://cdn.bootcss.com/vue/2.5.18-beta.0/vue.js"></script> <script src=" https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script> <style> *{margin: 0;padding: 0} .item img{ width: 100px; height: 100px; } #app{ display: flex; flex-direction: row; flex-wrap: wrap; width:400px; margin-left: auto; margin-right: auto; } .item{ margin-left: 20px; margin-bottom: 20px; } </style> </head> <body> <div id="app"> <div class="item" v-for="(item,index) of movies"> <img :src="item.imgUrl" alt=""> <h6>{{item.title}}</h6> </div> </div> <script> new Vue({ el:"#app", data:{ movies:[] }, mounted() { $.ajax({ url:"https://douban.uieee.com/v2/movie/top250", type:"GET", dataType:"jsonp", success:res=>{ var subjects=res.subjects; var movies=[]; subjects.forEach(res => { var title=res.title; var imgUrl=res.images.small; var temp={ title, imgUrl } movies.push(temp); }); this.movies=movies; } }) }, }) </script> </body> </html> ~~~ ![](https://box.kancloud.cn/4e0a8ba2d06a6c7bfb726ee5ac721c70_338x623.png) ![](https://box.kancloud.cn/1bec9fc934dc58d71f89f8193abc7dc8_339x379.png)