Skip to content

Commit

Permalink
feat: 添加palyer store 文件
Browse files Browse the repository at this point in the history
  • Loading branch information
wangrongding committed Mar 31, 2024
1 parent 10ce0ff commit 164db49
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/stores/player.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'

export const usePlayerStore = defineStore('playerStore', () => {
// 播放状态
const playStatus = ref(false)
// 切换播放状态
function togglePlay(state?: boolean) {
playStatus.value = state === undefined ? !playStatus.value : state
}
// 播放列表
const playList = ref([])
// 轨道数
const trackCount = computed(() => playList.value.length)

return { playStatus, togglePlay, playList, trackCount }
})

0 comments on commit 164db49

Please sign in to comment.