Skip to content

Commit be25b98

Browse files
committed
修复切换语言时动画异常
1 parent d99c4f0 commit be25b98

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/editor/datum.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
:label="t('inputs.fnType')"
77
v-model.lazy="dataItem.fnType"
88
@change="fnTypeChange(dataItem)"
9+
:key="selectKey"
910
>
1011
<s-picker-item
1112
v-for="(type, index) in fnTypeArr"
@@ -20,6 +21,7 @@
2021
v-model.lazy="dataItem.graphType"
2122
v-if="dataItem.graphType !== 'text'"
2223
@change="graphTypeChange(dataItem)"
24+
:key="selectKey"
2325
>
2426
<s-picker-item
2527
v-for="(type, index) in allowedGraphType"
@@ -106,7 +108,7 @@
106108
</template>
107109
<script setup lang="ts">
108110
import { useI18n } from "vue-i18n";
109-
const { t } = useI18n();
111+
const { t, locale } = useI18n();
110112
111113
import {
112114
fnTypeArr,
@@ -192,6 +194,10 @@ const fnType = computed(() => getFnType(dataItem.value?.fnType));
192194
const allowedGraphType = computed(() =>
193195
getAllowedGraphType(dataItem.value?.fnType)
194196
);
197+
198+
import { watch } from "vue";
199+
const selectKey = ref(0);
200+
watch(locale, () => selectKey.value++);
195201
</script>
196202

197203
<style>

src/editor/index.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
v-model="profile.data"
66
:animation="200"
77
handle=".datablock-drag"
8-
:key="draggerKey"
98
>
109
<Datum
1110
v-for="(dataItem, i) in profile.data"
@@ -27,7 +26,7 @@
2726

2827
<script setup lang="ts">
2928
import { useI18n } from "vue-i18n";
30-
const { t, locale } = useI18n();
29+
const { t } = useI18n();
3130
3231
import { VueDraggable } from "vue-draggable-plus";
3332
import ImportBtn from "./import.vue";
@@ -37,8 +36,4 @@ import OutputDrawer from "./output.vue";
3736
import { getNewDatum } from "@/consts";
3837
import { useProfile } from "@/consts";
3938
const profile = useProfile();
40-
41-
import { ref, watch } from "vue";
42-
const draggerKey = ref(0);
43-
watch(locale, () => draggerKey.value++);
4439
</script>

0 commit comments

Comments
 (0)