Spaces:
Paused
Paused
File size: 655 Bytes
730b0a8 |
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 30 31 |
import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import {reactive} from "vue";
export interface BoxStoreEntry {
top: number
left: number
title: string
emoji: string
loading?: boolean
}
export const useBoxesStore = defineStore('counter', () => {
const boxes = reactive<{
[key: string]: BoxStoreEntry
}>({
a: {top: 20, left: 80, title: 'Fire', emoji: '🔥'},
})
function addBox(box: BoxStoreEntry) {
const randomId = Math.random().toString(36).substr(2, 5)
boxes[randomId] = box
}
function removeBox(id: string) {
delete boxes[id]
}
return { boxes , removeBox, addBox}
})
|