wangrong
2026-08-30 761e5c5fa871959f60e15c971c8d83f2b53d0af5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { defineStore, storeToRefs } from 'pinia'
import { store } from '../../index'
import { dvMainStoreWithOut } from './dvMain'
 
const dvMainStore = dvMainStoreWithOut()
const { curComponent } = storeToRefs(dvMainStore)
 
export const animationStore = defineStore('animation', {
  actions: {
    addAnimation(animation) {
      curComponent.value.animations.push(animation)
    },
 
    removeAnimation(index) {
      curComponent.value.animations.splice(index, 1)
    },
 
    alterAnimation({ index, data = {} }) {
      if (typeof index === 'number') {
        const original = curComponent.value.animations[index]
        curComponent.value.animations[index] = { ...original, ...data }
      }
    }
  }
})
 
export const animationStoreWithOut = () => {
  return animationStore(store)
}