feat: 音乐插件保存歌单添加防抖。修复音乐插件全屏显示异常的问题。

This commit is contained in:
539943419 committed 2024-09-30 23:38:00 +08:00
1 parent 90a068939d
commit 483a573f06
1 file changed
+8 -3
@@ -50,6 +50,7 @@ import miaoMusicMain from './src/main.vue'
import collectionType from './types/collection'
import cloneDeep from 'lodash/cloneDeep'
import localForage from 'localforage'
import debounce from 'lodash/debounce'
const pluginCenter = usePluginCenter()
let ap = ref<apType>()
@@ -170,10 +171,13 @@ const initAPlayerMiao = () => {
})
}
const updateLocalData = () => {
// console.log('updateLocalData', toRaw(data.value))
const updateLocalData = debounce(() => {
console.log('update')
localForage.setItem('miaoMusic-storage-musicCollections', toRaw(data.value))
}
}, 1000, {
'leading': false,
'trailing': true
})
const getLocalData = async () => {
data.value =
(await localForage.getItem('miaoMusic-storage-musicCollections')) ?? []
@@ -199,6 +203,7 @@ onUnmounted(() => {
height: 100%;
display: flex;
flex-direction: column;
background-color: #ffffff;
}
</style>
<style lang="scss">