mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 新增删除功能
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ConfigType, PackagesStoreType, PackagesType } from './packagesStore.d'
|
||||
import { packagesList } from '@/packages/index'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { getLocalStorage, setLocalStorage } from '@/utils'
|
||||
|
||||
// 组件 packages
|
||||
export const usePackagesStore = defineStore({
|
||||
@@ -18,6 +20,13 @@ export const usePackagesStore = defineStore({
|
||||
addPhotos(newPhoto: ConfigType, index: number) {
|
||||
this.newPhoto = newPhoto
|
||||
this.packagesList.Photos.splice(index, 0, newPhoto)
|
||||
},
|
||||
deletePhotos(photoInfo: ConfigType, index: number) {
|
||||
this.packagesList.Photos.splice(index, 1)
|
||||
const StoreKey = StorageEnum.GO_USER_MEDIA_PHOTOS
|
||||
const userPhotosList = getLocalStorage(StoreKey)
|
||||
userPhotosList.splice(index - 1, 1)
|
||||
setLocalStorage(StoreKey, userPhotosList)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user