change backgrouynd

This commit is contained in:
expdsn 2024-10-09 14:57:24 +08:00
parent 356b68c361
commit 04f0294f0e
3 changed files with 9 additions and 5 deletions

View File

@ -152,6 +152,7 @@ export default defineComponent(() => {
{wallpaperList.value.map(item => {wallpaperList.value.map(item =>
<div <div
onClick={() => { onClick={() => {
layout.changeBackground(item.url)
}} }}
class="h-[156px] relative cursor-pointer group w-full flex-grow-0 rounded-xl overflow-hidden"> class="h-[156px] relative cursor-pointer group w-full flex-grow-0 rounded-xl overflow-hidden">
<img src={item.url + '?x-oss-process=image/resize,w_300'} class=" duration-150 absolute w-full h-full object-cover flex-grow-0 rounded-xl group-hover:scale-[1.2]" /> <img src={item.url + '?x-oss-process=image/resize,w_300'} class=" duration-150 absolute w-full h-full object-cover flex-grow-0 rounded-xl group-hover:scale-[1.2]" />

View File

@ -30,9 +30,9 @@ export type LayoutPages = { list: Block[]; label: string; name: string }[]
export interface Layout { export interface Layout {
content: [ content: [
{ background: ''; pages: LayoutPages }, { background: string; pages: LayoutPages },
{ background: ''; pages: LayoutPages }, { background: string; pages: LayoutPages },
{ background: ''; pages: LayoutPages } { background: string; pages: LayoutPages }
] ]
current: 0 | 1 | 2 // 游戏,工作,轻娱 current: 0 | 1 | 2 // 游戏,工作,轻娱
currentPage: number currentPage: number

View File

@ -98,7 +98,9 @@ export default defineStore('layout', () => {
} }
return block.label || '' return block.label || ''
} }
const changeBackground = (url: string) => {
state.content[state.current].background = url
}
return { return {
state, state,
ready, ready,
@ -109,6 +111,7 @@ export default defineStore('layout', () => {
addBlock, addBlock,
openDir, openDir,
checkDir, checkDir,
getLabel getLabel,
changeBackground
} }
}) })