zoukankan      html  css  js  c++  java
  • VueMusic-6首页-热门榜单

    1.实例

    <template>
    <div class="mod-albums">
    <div class="hd log url">
    <h2>{{title}}</h2>
    <div>更多</div>
    </div>
    <div class="container">
    <div class="gallery">
    <div class="scroller">
    <div class="card url" v-for="(item,index) in todayRecommend" :key="index">
    <div class="album">
    <img :src="item.pic_big" :alt="item.title">
    <div class="name">{{item.title}}</div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </template>

    <script>
    export default {
    name: "todayRecommend",
    data() {
    return {
    todayRecommend: []
    }
    },
    props:{
    title:{
    type:String,
    default:"今天榜单"
    },
    url:{
    type:String,
    default:"/v1/restserver/ting?method=baidu.ting.billboard.billList&type=1&size=6&offset=0"
    },

    },
    mounted() {
    var url = this.HOST + this.url
    this.$axios.get(url)
    .then(res => {
    console.log(res.data);
    this.todayRecommend = res.data.song_list
    }).catch(error => {
    console.log(error)
    })
    }
    }
    </script>

    <style scoped>
    .mod-albums {
    background-color: #fff;
    padding: 10px 17px;
    }

    .hd {
    display: flex;
    margin: 14px 0 18px 0;
    }

    .hd h2 {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    margin: 0;
    padding: 0;
    font-size: 20px;
    }

    .hd div {
    64px;
    font-size: 12px;
    text-align: right;
    }

    .mod-albums .gallery {
    overflow: hidden;
    margin: 0 -5px;
    }

    .mod-albums .gallery .card {
    33.3%;
    float: left;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    padding: 0 5px 10px;
    }

    .mod-albums .gallery .card .album {
    position: relative;
    }

    .mod-albums .gallery .card img {
    100%;
    height: auto;
    border: 1px solid #eee;
    }

    .mod-albums .gallery .card .name {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 4px;
    line-height: 14px;
    max-height: 28px;
    margin-bottom: 2px;
    }
    </style>

    2.实例

    <template>
    <div>
    <TodayRecommend title="今日推荐" url="/v1/restserver/ting?method=baidu.ting.billboard.billList&type=1&size=6&offset=0" />
    <NewsMusic />
    <SwiperBanner/>
    <MusicListNav/>
    <keep-alive> <router-view /></keep-alive>
    <TodayRecommend title="热门歌单" url="/v1/restserver/ting?method=baidu.ting.billboard.billList&type=24&size=6&offset=0" />
    </div>
    </template>

    <script>
    import TodayRecommend from '../components/Today_Recommend'
    import NewsMusic from '../components/News_Music'
    import SwiperBanner from '../components/Swiper_Banner'
    import MusicListNav from './musiclist/music_listnav'
    export default {
    name: "",
    data() {
    return {

    }
    },
    components:{TodayRecommend,NewsMusic,SwiperBanner,MusicListNav}
    }
    </script>

    <style scoped>
    .banner{
    padding: 10px;
    }
    </style>

  • 相关阅读:
    【一周读书】哲学家,你们都干了些什么?
    我的软件工程课目标
    【一周读书】《把时间当作朋友》《一个人就是一支骑兵》读书心得
    LANMP安全配置学习之PHP安全配置
    XXE漏洞学习
    利用bWAPP学习SSRF
    Vulnhub靶场之DC-1
    74CMS4.1.2.4版本黑盒测试
    业务逻辑漏洞——浅谈验证码漏洞
    bWAPP靶场之HTML Injection(GET)
  • 原文地址:https://www.cnblogs.com/xiao-peng-ji/p/11432059.html
Copyright © 2011-2022 走看看