feat: 音乐插件保存歌单添加防抖。修复音乐插件全屏显示异常的问题。
This commit is contained in:
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 collectionType from './types/collection'
|
||||||
import cloneDeep from 'lodash/cloneDeep'
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import localForage from 'localforage'
|
import localForage from 'localforage'
|
||||||
|
import debounce from 'lodash/debounce'
|
||||||
|
|
||||||
const pluginCenter = usePluginCenter()
|
const pluginCenter = usePluginCenter()
|
||||||
let ap = ref<apType>()
|
let ap = ref<apType>()
|
||||||
@@ -170,10 +171,13 @@ const initAPlayerMiao = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateLocalData = () => {
|
const updateLocalData = debounce(() => {
|
||||||
// console.log('updateLocalData', toRaw(data.value))
|
console.log('update')
|
||||||
localForage.setItem('miaoMusic-storage-musicCollections', toRaw(data.value))
|
localForage.setItem('miaoMusic-storage-musicCollections', toRaw(data.value))
|
||||||
}
|
}, 1000, {
|
||||||
|
'leading': false,
|
||||||
|
'trailing': true
|
||||||
|
})
|
||||||
const getLocalData = async () => {
|
const getLocalData = async () => {
|
||||||
data.value =
|
data.value =
|
||||||
(await localForage.getItem('miaoMusic-storage-musicCollections')) ?? []
|
(await localForage.getItem('miaoMusic-storage-musicCollections')) ?? []
|
||||||
@@ -199,6 +203,7 @@ onUnmounted(() => {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
Reference in new issue
Block a user