File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 2
2
<div class =" h-screen bg-black text-white flex lg:h-[80vh] p-16 lg:p-8" />
3
3
<CardviewModal
4
4
:id =" state.id"
5
- @close =" $router.back() "
5
+ @close =" onClose "
6
6
/>
7
7
</template >
8
8
9
9
<script setup lang="ts">
10
10
import CardviewModal from " @/components/modals/CardviewModal.vue" ;
11
11
import { onMounted , reactive } from " vue" ;
12
- import { useRoute } from " vue-router" ;
12
+ import { useRoute , useRouter } from " vue-router" ;
13
13
14
14
const initialState: {
15
15
id: number ;
@@ -18,6 +18,7 @@ const initialState: {
18
18
};
19
19
20
20
const route = useRoute ();
21
+ const router = useRouter ();
21
22
const state = reactive (initialState );
22
23
23
24
onMounted (() => {
@@ -26,4 +27,12 @@ onMounted(() => {
26
27
state .id = id ;
27
28
}
28
29
});
30
+
31
+ const onClose = () => {
32
+ if (router .options .history .state .back ) {
33
+ router .back ();
34
+ } else {
35
+ router .push (' /' );
36
+ }
37
+ }
29
38
</script >
You can’t perform that action at this time.
0 commit comments