change
This commit is contained in:
parent
24adb4d996
commit
5e145b83ad
|
@ -21,7 +21,6 @@ export default defineComponent(() => {
|
|||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
watch(() => layout.state.content[selected.value].background, console.log, { immediate: true })
|
||||
const resource = useResource(
|
||||
computed(() => layout.state.content[selected.value].background),
|
||||
'background'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { ossCdnBase, videoArr } from '@/config'
|
||||
import db from '@/db'
|
||||
import useSettingsStore from '@/settings/useSettingsStore'
|
||||
import { reactive, watch, type Ref } from 'vue'
|
||||
|
||||
const defaultBackground =
|
||||
|
@ -13,15 +14,17 @@ const defaultResource = {
|
|||
}
|
||||
export default function useResource(tag: Ref<string>, type: string) {
|
||||
const resource = reactive(defaultResource)
|
||||
const settings = useSettingsStore()
|
||||
watch(
|
||||
tag,
|
||||
(val) => {
|
||||
// '' 表示使用默认,如果是背景,使用默认背景图片
|
||||
if (!val) {
|
||||
Object.assign(resource, {
|
||||
...defaultResource,
|
||||
image: type === 'background' ? defaultBackground : ''
|
||||
})
|
||||
if (type === 'background' && !settings.state.used) {
|
||||
Object.assign(resource, { ...defaultResource, image: defaultBackground })
|
||||
} else {
|
||||
Object.assign(resource, defaultResource)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (val.startsWith('http')) {
|
||||
|
|
|
@ -7,6 +7,8 @@ export default defineStore(
|
|||
'settings',
|
||||
() => {
|
||||
const state = reactive({
|
||||
// 是否用过
|
||||
used: false,
|
||||
maskOpacity: 0,
|
||||
maskFilter: 0,
|
||||
// 显示隐藏
|
||||
|
|
Loading…
Reference in New Issue