designtopack/src/components/project/virtual-sample/StaticView.vue

53 lines
1.4 KiB
Vue
Raw Normal View History

<template>
<header role="tablist" aria-labelledby="tablist">
<button
2024-11-21 13:20:57 +01:00
v-if="step.files.static.rawGlass"
id="verre-brut-label"
type="button"
role="tab"
:aria-selected="activeTab === 'rawGlass' ? true : false"
aria-controls="verre-brut"
tabindex="-1"
@click="activeTab = 'rawGlass'"
>
<span class="label">Verre brut</span>
</button>
<button
2024-11-21 13:20:57 +01:00
v-if="step.files.static.finishedGlass"
id="verre-paracheve-label"
type="button"
role="tab"
:aria-selected="activeTab === 'finishedGlass' ? true : false"
aria-controls="verre-paracheve"
@click="activeTab = 'finishedGlass'"
>
<span class="label">Verre parachevé</span>
</button>
</header>
2024-12-19 16:03:20 +01:00
<div id="vpv-container" class="dialog__inner">
2024-11-28 14:45:45 +01:00
<PdfViewer />
</div>
</template>
2024-11-21 13:20:57 +01:00
<script setup>
2025-03-07 17:29:11 +01:00
import { ref, watch } from 'vue';
import { useVirtualSampleStore } from '../../../stores/virtualSample';
import PdfViewer from '../PdfViewer.vue';
import { storeToRefs } from 'pinia';
import { useDialogStore } from '../../../stores/dialog';
2024-11-21 13:20:57 +01:00
2025-03-07 17:29:11 +01:00
const { step } = storeToRefs(useVirtualSampleStore());
2024-12-20 12:36:21 +01:00
const { openedFile, activeTracks } = storeToRefs(useDialogStore());
2025-03-07 17:29:11 +01:00
const activeTab = ref(Object.keys(step.value.files.static)[0]);
2024-11-28 14:45:45 +01:00
2024-12-20 12:36:21 +01:00
activeTracks.value = [];
2024-11-28 14:45:45 +01:00
watch(
activeTab,
(newVal) => {
2025-03-07 17:29:11 +01:00
openedFile.value = step.value.files.static[newVal];
2024-11-28 14:45:45 +01:00
},
{ immediate: true }
);
2024-11-21 13:20:57 +01:00
</script>