forked from Linho1219/function-plot-GUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.vue
More file actions
98 lines (90 loc) · 2.21 KB
/
index.vue
File metadata and controls
98 lines (90 loc) · 2.21 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<template>
<div id="editor">
<s-tab v-model.lazy="currentTab">
<s-tab-item v-for="(item, index) in tabs" :value="String(index)">
<div slot="text">{{ t(item.caption) }}</div>
</s-tab-item>
</s-tab>
<div id="editor-inner">
<Transition :name="transitionName">
<component :is="tabs[currentTabIndex].component" />
</Transition>
<ImportBtn />
</div>
</div>
<OutputDrawer />
</template>
<script setup lang="ts">
import { useI18n } from "vue-i18n";
import { I18nSchema } from "@/i18n";
const { t } = useI18n<{ message: I18nSchema }>();
import ImportBtn from "./import.vue";
import DataList from "./dataList.vue";
import AnnotaionList from "./annotationList.vue";
import GraphOptions from "./options.vue";
import OutputDrawer from "./output.vue";
import { computed, ref, watch } from "vue";
const currentTab = ref("0");
const currentTabIndex = computed(() => Number(currentTab.value));
const transitionName = ref("");
const tabs = [
{ caption: "editor.functions", component: DataList },
{ caption: "editor.annotations", component: AnnotaionList },
{ caption: "editor.graphOptions", component: GraphOptions },
];
watch(currentTabIndex, (newVal, oldVal) => {
if (newVal > oldVal) transitionName.value = "slide-left";
else transitionName.value = "slide-right";
});
</script>
<style>
#editor {
display: flex;
flex-direction: column;
}
#editor-inner {
height: 0;
flex-grow: 1;
position: relative;
}
#editor-inner s-scroll-view {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>
<style>
.slide-left-enter-active,
.slide-left-leave-active,
.slide-right-enter-active,
.slide-right-leave-active {
transition: transform var(--s-motion-duration-medium2)
var(--s-motion-easing-emphasized);
}
.slide-right-enter-from {
transform: translateX(-100%);
}
.slide-right-enter-to {
transform: translateX(0);
}
.slide-right-leave-from {
transform: translateX(0);
}
.slide-right-leave-to {
transform: translateX(100%);
}
.slide-left-enter-from {
transform: translateX(100%);
}
.slide-left-enter-to {
transform: translateX(0);
}
.slide-left-leave-from {
transform: translateX(0);
}
.slide-left-leave-to {
transform: translateX(-100%);
}
</style>