kaban > step uri : fix reactivity problem
This commit is contained in:
parent
82e944cd31
commit
9b5a61e57d
2 changed files with 9 additions and 7 deletions
|
|
@ -34,7 +34,9 @@
|
|||
</article>
|
||||
</template>
|
||||
<script setup>
|
||||
import { useRoute } from "vue-router";
|
||||
import DateTime from "./DateTime.vue";
|
||||
import { computed } from "vue";
|
||||
|
||||
const { step, pdf, index } = defineProps({
|
||||
step: Object,
|
||||
|
|
@ -46,11 +48,11 @@ const { step, pdf, index } = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const uri =
|
||||
location.pathname + "?dialog=" + step.slug + "&fileIndex=" + getIndex();
|
||||
const route = useRoute();
|
||||
|
||||
function getIndex() {
|
||||
if (index) return index;
|
||||
return step.files.findIndex((file) => file.type === "document");
|
||||
}
|
||||
const uri = computed(() => {
|
||||
const fileIndex =
|
||||
index ?? step.files.findIndex((file) => file.type === "document");
|
||||
return `${route.fullPath}?dialog=${step.slug}&fileIndex=${fileIndex}`;
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import Header from "../components/project/Header.vue";
|
|||
import DialogWrapper from "../components/project/DialogWrapper.vue";
|
||||
import { usePageStore } from "../stores/page";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { watch } from "vue";
|
||||
import { computed, watch } from "vue";
|
||||
import { useDialogStore } from "../stores/dialog";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue