• VueMusic-5首页-音乐榜单


    1.音乐榜单组件

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

    <script>
    export default {
    name: "newsMusic",
    data() {
    return {
    newsMusic: []
    }
    },
    mounted() {
    var url = this.HOST + "/v1/restserver/ting?method=baidu.ting.billboard.billList&type=2&size=3&offset=0"
    this.$axios.get(url)
    .then(res => {
    console.log(res.data);
    this.newsMusic = res.data.song_list
    }).catch(error => {
    console.log(error)
    })
    }
    }
    </script>

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

    .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;
    }
    .mod-albums .gallery .card .author {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #999;
    font-size: 12px;
    line-height: 12px;
    }
    </style>

    2.缓存

    <template>
    <div>
    <TodayRecommend />
    <NewsMusic />
    <SwiperBanner/>
    <MusicListNav/>
    <keep-alive> <router-view /></keep-alive>
    </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>

  • 相关阅读:
    还是不能偷懒ForEach陷阱
    备忘ForEach方法与foreach迭代器使用小区别
    备忘反射调用Private方法
    机器人也会梦见电子羊吗
    Windows 7 下Skype最小化到系统托盘
    编译Boost_1_37_0 For VS2008
    使用API判断网络是否连通(InternetGetConnectedState / IsNetworkAlive)
    SVN中“txncurrentlock:拒绝访问”错误
    幂函数的非递归算法
    Visual Studio中的文件类型(sln vcproj suo user ncb)
  • 原文地址:https://www.cnblogs.com/xiao-peng-ji/p/11421286.html
Copyright © 2020-2023  润新知