Vue实现音乐网站

该项目基于Vue2.0构建,功能包括页面渲染、推荐页面、歌手列表、音乐播放器、歌手详情、滑动分页、音乐点播和分享。代码示例展示了歌曲控制和播放状态的处理。环境搭建使用vue-cli,后台可采用MySQL或mangoDB,运行项目需执行npminstall和npmrundev命令。
摘要由CSDN通过智能技术生成

项目功能

以vue2.0为开发基石,实现手机端音乐网站,功能丰富,主要实现如下
——页面渲染
——推荐页面
——歌手列表
——酷炫播放器
——歌手详情
——滑动分页
——音乐点播
——音乐分享

项目结构

项目部分代码

// 填充歌曲信息 控制歌曲播放
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

项目截图

相关源码

(9.99元——打赏后评论或者备注留言,例如:”已支持,your_email@xxx.com,music”)

一年365天,希望各位看官达人多多支持,打赏后将及时发送源码或者视频资源,操作如下

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dkjhl

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值