项目功能
以vue2.0为开发基石,实现手机端音乐网站,功能丰富,主要实现如下
——页面渲染
——推荐页面
——歌手列表
——酷炫播放器
——歌手详情
——滑动分页
——音乐点播
——音乐分享
项目结构
![](https://i-blog.csdnimg.cn/blog_migrate/79dc9c579211e0a5c076ed9223c1f932.png)
项目部分代码
// 填充歌曲信息 控制歌曲播放
computed: {
cdCls() {
return this.playing ? 'play' : 'pause'
},
playIcon() {
return this.playing ? 'icon-pause' : 'icon-play'
},
miniIcon() {
return this.playing ? 'icon-pause-mini' : 'icon-play-mini'
},
disableCls() {
return this.songReady ? '' : 'disable'
},
percent() {
return this.currentTime / this.currentSong.duration
},
iconMode() {
return this.mode === playMode.sequence ? 'icon-sequence' : this.mode === playMode.loop ? 'icon-loop' : 'icon-random'
},
...mapGetters([
'fullScreen',
'playing',
'currentIndex'
])
},
watch: {
currentSong(newSong, oldSong) {
// 当列表没有歌曲时 直接return
if (!newSong.id) return
if (newSong === oldSong) {
return
}
// 防止歌词切换跳动
if (this.currentLyric) {
this.currentLyric.stop()
}
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.$refs.audio.play()
this.getLyric()
}, 1000)
},
playing(newPlaying) {
const audio = this.$refs.audio
this.$nextTick(() => {
newPlaying ? audio.play() : audio.pause()
})
}
},
环境搭建
初始化环境参考:利用vue-cli搭建vue项目框架
后台数据库:MySQL/mangoDB
项目运行
npm install,npm run dev
访问地址:localhost:8080
项目截图
![](https://i-blog.csdnimg.cn/blog_migrate/fb9d51e4697d6948537d2ffa1c488186.png)
![](https://i-blog.csdnimg.cn/blog_migrate/ea49a9c8b84db84b6f69a99f9614316a.png)
![](https://i-blog.csdnimg.cn/blog_migrate/e3c8ff72c9f9fda0a4031e850dcbe90f.png)
![](https://i-blog.csdnimg.cn/blog_migrate/9f8b2336d4cc31bd27b865d6b4760726.png)
![](https://i-blog.csdnimg.cn/blog_migrate/a2fc3783cb6c9b89960058fe543e8b07.png)
![](https://i-blog.csdnimg.cn/blog_migrate/0bb56325ffec4b495a5087b38a7e64e6.png)
![](https://i-blog.csdnimg.cn/blog_migrate/c8ed12252c6dbfda4b6db9cbaa802848.png)
![](https://i-blog.csdnimg.cn/blog_migrate/cb9145c63d4df376e77b19a2886042eb.png)
相关源码
(9.99元——打赏后评论或者备注留言,例如:”已支持,your_email@xxx.com,music”)
一年365天,希望各位看官达人多多支持,打赏后将及时发送源码或者视频资源,操作如下
![](https://i-blog.csdnimg.cn/blog_migrate/0a94c1c27bfb34b390d6b3a9a7ea3440.png)