百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 热门文章 > 正文

vue+element高度仿照QQ音乐 从qq音乐给vue添加音乐

bigegpt 2024-10-17 08:06 4 浏览

一.前言

QQ音乐官网:点击访问

作者成品效果预览:点击访问

作者其他博客成品汇总预览:点击访问

暂时源码并没有提供其他获取渠道,私聊作者获取即可,或通过博客后面名片添加作者,很简单!

二.主要功能点列表

顶级菜单

二级菜单

歌单推荐

新歌首发

精彩推荐

新碟首发

排行榜

MV

通用网站底部(版权、企业信息等)

三.产品效果图

1.切换顶级菜单、二级菜单:

2.歌单推荐(菜单切换+轮播):

3.新歌首发(菜单切换+轮播):

4.精彩推荐(轮播):

5.新碟首发(菜单切换+轮播):

6.排行榜(背景图裁剪实现:background-position属性):

7.MV(菜单切换+轮播):

四.实现

项目目录截图:

img存放各种静态图片资源等;

page目录是通用目录文件(看名称几乎也能明白了),top就是网站通用顶部,index就是框架通用主体盒子,foot就是网站通用底部;

router就是路由;

views其他功能目录文件,子目录home目录为首页,其他子目录功能待开发实现;

components为组件存放目录,子目录home专门存放首页组件页面(歌单推荐、新歌首发、精彩推荐。。mv等),所以首页已经被拆分成各个子页面,非常美观和利于后续功能拓展或修改

首页主页面 views/home/index.vue,通过引入子页面组件:

<template>

<div style="font-size: 14px;">

<song-sheet-recommend></song-sheet-recommend>

<new-song-first></new-song-first>

<hot-recommend></hot-recommend>

<new-dish-first></new-dish-first>

<ranking-list></ranking-list>

<mv></mv>

</div>

</template>

<script>

import songSheetRecommend from "../../components/home/song_sheet_recommend.vue";

import newSongFirst from "../../components/home/new_song_first.vue";

import hotRecommend from "../../components/home/hot_recommend.vue";

import newDishFirst from "../../components/home/new_dish_first.vue";

import rankingList from "../../components/home/ranking_list.vue";

import mv from "../../components/home/mv.vue";

export default {

components: {

songSheetRecommend,

newSongFirst,

hotRecommend,

newDishFirst,

rankingList,

mv

},

data() {

return {

};

},

mounted() {

},

methods: {

}

};

</script>

<style>

</style>

歌单推荐(首页其中子页面之一),菜单切换,模拟数据交互,types1和types2赋值给types:

<template>

<div class="mod_bg" style="font-size: 14px;">

<div style="margin: 0 10%;">

<div class="mod_title">

歌单推荐

</div>

<div class="mod_small_title">

<span v-for="(item,index) in submenus" :key="index" :class="subMenuIndex!==index?'sub-menu-hover':''" @click="selSubMenu(index)" :style="'padding: 10px 30px;'+(subMenuIndex===index?'color: #31c27c;':'')">

{{item.name}}

</span>

</div>

<div>

<el-carousel trigger="click" :autoplay="false" height="350px">

<el-carousel-item v-for="i in 4" :key="i" indicator-position="outside">

<div style="margin: 0 10%;" class="recommend-box">

<div class="recommend-item" v-for="(item,index) in types" :key="index">

<div class="play-item">

<div style="text-align: center;height: 224px;overflow: hidden;">

<el-image :src="item.img" fit="cover" style="width: 100%;height: 224px;" class="cover"></el-image>

</div>

<div class="play-box">

<img src="../../../public/img/cover_play.png">

</div>

</div>

<div class="recommend-item-title title-active">

{{item.name}}

</div>

<div class="recommend-item-des">

播放量:{{item.playNum}}

</div>

</div>

</div>

</el-carousel-item>

</el-carousel>

</div>

</div>

</div>

</template>

<script>

export default {

data() {

return {

subMenuIndex: 0,

submenus: [

{name:'为你推荐'},

{name:'经典'},

{name:'网络歌曲'},

{name:'韩语'},

{name:'官方歌单'},

{name:'情歌'},

],

types:[],

types1:[

{name:'二哥抖音最火',playNum:'4357.9万',img:require('../../../public/img/recommend1.jpg')},

{name:'华语天花板:奏响青春的时代乐章',playNum:'1190.5万',img:require('../../../public/img/recommend2.jpg')},

{name:'冬季限定 ·冰雪世界专属电音BGM',playNum:'4.3万',img:require('../../../public/img/recommend3.jpg')},

{name:'车载DJ热歌:轻松一路Fun肆嗨!',playNum:'4534.6万',img:require('../../../public/img/recommend4.jpg')},

{name:'爱的故事翻篇,被爱的人不用道歉',playNum:'2037.3万',img:require('../../../public/img/recommend5.jpg')}

],

types2:[

{name:'不为人知的天才,老一辈香港音乐人',playNum:'51.5万',img:require('../../../public/img/recommend6.jpg')},

{name:'以漂亮的姿势,穿越到八十年代',playNum:'87.5万',img:require('../../../public/img/recommend7.jpg')},

{name:'「经典粤语」唱着你我的悲欢离合',playNum:'123.3万',img:require('../../../public/img/recommend8.jpg')},

{name:'重温一把当年的火,粤语经典',playNum:'104.9万',img:require('../../../public/img/recommend9.jpg')},

{name:'有一种歌词,叫小美',playNum:'315.7万',img:require('../../../public/img/recommend10.jpg')}

]

};

},

mounted() {

this.types = this.types1;

},

methods: {

selSubMenu(index){//切換菜單

this.subMenuIndex = index;

console.info(index % 2);

if(index % 2 === 0){

this.types = this.types1;

}else{

this.types = this.types2;

}

},

}

};

</script>

<style>

.mod_bg {

background: url("../../../public/img/bg_detail.jpg") 50% 0 repeat-x;

/*background: linear-gradient(to bottom, #FFFFFF,#FFFFFF,#FFFFFF, #eeeeee);*/

}

.mod_bg .el-carousel__button{

background-color: #67e56d !important;

}

.mod_title{

height: 40px;

line-height: 40px;

font-size: 28px;

font-weight: bolder;

color: #3a3a3a;

text-align: center;

padding: 50px 0 24px 0;

letter-spacing:10px;

}

.mod_small_title{

text-align: center;

height: 50px;

line-height: 50px;

font-size: 15px;

}

.recommend-box{

display: flex;

}

.recommend-item{

width: calc(20% - 0px);

margin: 10px 10px 10px 10px;

cursor: pointer;

}

.recommend-item:first-of-type{

margin: 10px 10px 10px 0!important;

}

.recommend-item:last-of-type{

margin: 10px 0 10px 10px!important;

}

.recommend-item-title{

height: 22px;

line-height: 22px;

overflow: hidden;

text-overflow: ellipsis;

margin-top: 15px;

}

.title-active:hover{

cursor: pointer;

color: #31c27c;

}

.recommend-item-des{

color: #999;

}

.play-box{

opacity: 0;

position: relative;

text-align: center;

height: 224px;

overflow: hidden;

margin-top: -224px;

background-color: rgba(161, 161, 161, 0.5);

}

.play-box img{

width: 25px;

height: 25px;

margin-top: 87px;

}

.play-item:hover .cover{

transition: transform 1s ease 0s;

transform: scale(1.1);

}

.play-item:hover .play-box{

opacity: 1;

}

.play-item:hover .play-box img{

transition: transform 0.5s ease 0s;

transform: scale(2);

}

</style>

五.总结

以QQ音乐官方网站作为参考,模拟实现,实现最终的效果还是满意的,样式交互等也是最大化模拟官方的,后续再不断完善、增加其他功能和其他页面。


需要源码:点赞 + 关注 + 留言 + 私信


觉得不错的点个赞,如有建议的请留言,非常感谢!
如需帮助,私聊作者即可!再次感谢~

相关推荐

LangChain4j如何自定义文档转换器实现数据清洗?

LangChain4j提供了3种RAG(Retrieval-AugmentedGeneration,检索增强生成)实现,我们通常在原生或高级的RAG实现中,要对数据进行清洗,也就是将外接...

Java 8 Stream API 详解(java stream.)

Java8StreamAPI详解一、概述在Java8中,StreamAPI是一个重要的新特性。它为处理集合(如List、Set等)中的元素提供了一种高效且富有表现力的方式。Str...

Java修炼终极指南:185 使用 Stream 过滤嵌套集合

这是面试中的一个经典问题,通常从一个模型开始,如下所示(我们假设集合是一个List):publicclassAuthor{privatefinalStringname;pri...

java8的stream使用小示例(java stream())

据JetBrains发布的2021年开发者生态系统调查,Java8在java使用的版本中仍然是当前最流行的版本。72%的专业开发人员使用Java8作为其在java开发中主要编程语言版本。现...

Node.js Stream - 实战篇(node.js in action)

本文转自“美团点评技术团队”http://tech.meituan.com/stream-in-action.html背景前面两篇(基础篇和进阶篇)主要介绍流的基本用法和原理,本篇从应用的角度,介...

Java Stream:集合处理的api(java 集合操作)

JavaStream流:高效集合处理的函数式编程利器一、什么是JavaStream?Java8引入的StreamAPI是一套用于处理集合数据的流式编程接口,通过函数式风格(无副作用的...

去除 List 中的重复元素,你知道几种实现方法?

去除List中重复元素,这在实际编程或面试中经常遇到,每个人都有习惯的写法吧,这里抛砖引玉,汇总了一些实现方案,开拓思路。准备数据假设数组中有10个数据,可能有重复,需要将重复的数据从数组中去掉。pu...

Java开发者必看!Stream流式编程10个爆款技巧,让你代码优雅飞起

为什么你的Java代码总像拧巴的麻绳?掌握这10个Stream实战技巧,代码效率与优雅度将产生质的飞跃。以下案例均来自真实电商系统场景,带你感受流式编程的降维打击!一、过滤与映射组合拳(Filter...

leetcode每日一题之存在重复元素(存在重复元素 iii)

题:给定一个整数数组,判断是否存在重复元素。如果存在一值在数组中出现至少两次,函数返回true。如果数组中每个元素都不相同,则返回false。比如:输入:[1,2,3,1]输出:true...

告别for循环!揭秘Stream API如何让你的代码简洁度提升300%

一、当传统循环遇上现代需求真实场景复现:某电商平台需要处理10万条订单数据,要求:筛选出金额>500的订单提取用户ID并去重统计VIP用户数量传统实现方案://常规写法Set<Long...

Java中List去重的N种方法:从基础到优雅

Java中List去重的N种方法:从基础到优雅在日常的Java开发中,我们经常会遇到需要对List集合去重的情况。无论是为了清理重复的数据,还是为了优化算法性能,掌握多种去重方式都是一项非常实用的技能...

Java Stream流没用过?常用高频方法

概念Stream流是Java8添加的以一种链式调用的方法处理数据,主要侧重于计算。具有以下相关特点代码简洁链式调用Stream常用方法1.将数组变为当作List操作String[]strArr=...

核医学专业名词索引(M-R)(核医学重点归纳)

M吗啡(morphia)埋藏式心律转复除颤器(implantablecardioverterdefibrillator,ICD)麦角骨化醇(VD2,calciferol)脉冲堆积(pulsepi...

CodeMeter 新版发布(codesigner下载)

威步于2022年8月4日发布CodeMeter7.50及CodeMeter软件保护套装11.10,以下为新版内容。CodeMeterRuntime7.50StreamingSIMDExten...

世界上最小的五轴铣床Pocket NC(最小的五轴加工中心)

PocketNC,由MIT学生研制,还有说法是这款产品的设计者是来自美国蒙大拿州的一对极客夫妻。目前主要有两款产品:PocketNCV2-50,9000美元;PocketNCV2-10,60...