useApplicationsStore.js
1.44 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { defineStore } from 'pinia';
import { reactive, ref } from 'vue';
import ALIGNERICON from '@/views/assets/images/application-field/applications/aligner.png';
import TRAYICON from '@/views/assets/images/application-field/applications/tray.png';
import SPLINTICON from '@/views/assets/images/application-field/applications/splint.png';
import IMPLANTICON from '@/views/assets/images/application-field/applications/implant.png';
import BRIDGEICON from '@/views/assets/images/application-field/applications/bridge.png';
export const useApplicationsStore = defineStore('applications', () => {
const items = reactive([
{
key: 'aligner',
image: ALIGNERICON,
enabled: true
},
{
key: 'tray',
image: TRAYICON,
enabled: true
},
{
key: 'splint',
image: SPLINTICON,
enabled: true
},
{
key: 'implant',
image: IMPLANTICON,
enabled: false
},
{
key: 'bridge',
image: BRIDGEICON,
enabled: false
}
]);
const selecteditem = ref('aligner');
const handleSelect = (key) => {
const item = items.find((el) => el.key === key);
if (item && item.enabled) {
selecteditem.value = key;
}
};
return {
items,
selecteditem,
handleSelect
};
});