Bootstrap

uniapp音乐播放器

音乐播放器uniapp+vuex

// import music from "@/lead_in/music.js"
export default {
   
	// 往主vueX里引入需要用箭头函数
	state: () => ({
   
		num: 0,
		music: null, //播放实体
		status: false, //false暂停状态
		currentTime: 0, //当前时间
		duration: 0, //时长
		order: 1, //0随机,1表单循环,2单首循环
		musicList: [
			"http://img.eonfox.cc/dj%2F%E8%B5%B5%E8%8A%B7%E5%BD%A4-%E7%94%9C%E7%94%9C%E5%92%B8%E5%92%B8(DJ%E5%90%8D%E9%BE%99%E7%89%88).mp3",
			"http://img.eonfox.cc/dj%2F%E5%BC%A0%E8%8C%9C%20-%20%E7%94%A8%E5%8A%9B%E6%B4%BB%E7%9D%80%20(DJ%E6%B2%88%E5%BF%B5%E9%87%8D%E9%BC%93%E7%89%88).mp3",
			"http://img.eonfox.cc/dj%2F%E5%8F%B6%E9%87%8C%20-%20%E4%BA%BA%E9%97%B4%E6%83%8A%E9%B8%BF%E5%AE%A2%20(DJ%E6%B2%88%E5%BF%B5%E7%89%88).mp3",
			"http://img.eonfox.cc/dj%2F%E8%B5%B5%E8%8A%B7%E5%BD%A4-%E7%94%9C%E7%94%9C%E5%92%B8%E5%92%B8(DJ%E5%90%8D%E9%BE%99%E7%89%88).mp3",
			"http://img.eonfox.cc/dj%2F%E5%BC%A0%E8%8C%9C%20-%20%E7%94%A8%E5%8A%9B%E6%B4%BB%E7%9D%80%20(DJ%E6%B2%88%E5%BF%B5%E9%87%8D%E9%BC%93%E7%89%88).mp3",
			"http://img.eonfox.cc/dj%2F%E5%8F%B6%E9%87%8C%20-%20%E4%BA%BA%E9%97%B4%E6%83%8A%E9%B8%BF%E5%AE%A2%20(DJ%E6%B2%88%E5%BF%B5%E7%89%88).mp3",
			"http://img.eonfox.cc/dj%2F%E8%B5%B5%E8%8A%B7%E5%BD%A4-%E7%94%9C%E7%94%9C%E5%92%B8%E5%92%B8(DJ%E5%90%8D%E9%BE%99%E7%89%88).mp3",
			"http://img.eonfox.cc/dj%2F%E5%BC%A0%E8%8C%9C%20-%20%E7%94%A8%E5%8A%9B%E6%B4%BB%E7%9D%80%20(DJ%E6%B2%88%E5%BF%B5%E9%87%8D%E9%BC%93%E7%89%88).mp3",
			"http://img.eonfox.cc/dj%2F%E5%8F%B6%E9%87%8C%20-%20%E4%BA%BA%E9%97%B4%E6%83%8A%E9%B8%BF%E5%AE%A2%20(DJ%E6%B2%88%E5%BF%B5%E7%89%88).mp3"
		]
	}),
	mutations: {
   
		order_fn(state, data) {
   
			if (state.order == 1) {
   
				state.order = 2
			} else 
			if (state.order == 2) {
   
				state.order = 
;