美文网首页
2019-05-14

2019-05-14

作者: 刚刚好_1747 | 来源:发表于2019-05-14 08:24 被阅读0次

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
    #app{
    width: 1200px;
    margin: 0 auto;
    }
    .mer{
    box-sizing: border-box;
    width: 400px;
    height: 240px;
    float: left;
    background-color: darkgray;
    border: 1px solid green;
    }
    .mer div:first-child{

            float: left;
        }
    
        .mer div:last-child{
    
            width: 300px;
            margin-left: auto;
        }
    </style>
    <script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script>
    

    </head>
    <body>
    <div id="app">
    <div class="mer" v-for="m of merchants">
    <div>
    <img :src="m.head">
    <p>{{m.dur}}分钟</p>
    </div>
    <div>
    <h3>{{m.name}}</h3>
    <p>配送费{{m.fei}}</p>
    </div>

        </div>
    </div>
    <script>
    
        new Vue({
            el:"#app",
            data:{
                merchants:[]
            },
            mounted(){
                fetch("https://api.myjson.com/bins/1863yu",{method:"GET"})
                    .then(resp=>resp.json())
                    .then(merchants=>this.merchants=merchants)
            }
        })
    </script>
    

    </body>
    </html>

    相关文章

      网友评论

          本文标题:2019-05-14

          本文链接:https://www.haomeiwen.com/subject/ykrjaqtx.html