Skip to content

Commit 14b31b2

Browse files
committed
refactor: reorganize code structure and improve readability in App.vue
1 parent f4edb0b commit 14b31b2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

playground/src/App.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,15 @@ const stop = useRaf(
325325
body: newInput,
326326
}).then((res) => res.text())
327327
} catch (error) {
328-
code = await transformVue(newInput, {
329-
isRem: isChecked.value,
330-
})
328+
try {
329+
code = await transformVue(newInput, {
330+
isRem: isChecked.value,
331+
})
332+
} catch (e) {
333+
// Handle error 弹窗暴露错误消息
334+
alert('Error: ' + e)
335+
return
336+
}
331337
}
332338
333339
// Properly dispose of the old editor before creating a new one
@@ -451,7 +457,6 @@ function onSelect(value: any) {
451457
})
452458
}
453459
</script>
454-
455460
<template>
456461
<div absolute flex="~ gap-2" z-2 left-2 top-5>
457462
<div
@@ -512,9 +517,7 @@ function onSelect(value: any) {
512517
</div>
513518
<div min-h-20 flex items-center justify-center>
514519
<div v-if="transform" flex="~ gap-4" items-center>
515-
<div font-bold text="18px">
516-
{{ t('result') }}
517-
</div>
520+
<div font-bold text="18px">{{ t('result') }}</div>
518521
<div flex gap-2 items-center break-all>
519522
{{ transform }}
520523
<div
@@ -582,7 +585,6 @@ function onSelect(value: any) {
582585
</h1>
583586
<div pb20 data-v-display v-html="display" />
584587
</template>
585-
586588
<style scoped>
587589
.textshadow::after {
588590
bottom: 0;
@@ -598,7 +600,6 @@ function onSelect(value: any) {
598600
z-index: 1;
599601
}
600602
</style>
601-
602603
<style>
603604
.ant-select-selector {
604605
height: 50px !important;

0 commit comments

Comments
 (0)