Skip to content

Commit fecd53c

Browse files
committed
refactor: convert components to setup syntax
1 parent dae1484 commit fecd53c

File tree

3 files changed

+30
-44
lines changed

3 files changed

+30
-44
lines changed

src/components/CodemirrorEditor/AboutDialog.vue

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
<script>
2-
export default {
3-
props: {
4-
visible: {
5-
type: Boolean,
6-
default: false,
7-
},
8-
},
9-
emits: [`close`],
10-
methods: {
11-
onRedirect(url) {
12-
window.open(url)
13-
},
1+
<script setup>
2+
const props = defineProps({
3+
visible: {
4+
type: Boolean,
5+
default: false,
146
},
7+
})
8+
9+
defineEmits([`close`])
10+
11+
function onRedirect(url) {
12+
window.open(url)
1513
}
1614
</script>
1715

1816
<template>
1917
<el-dialog
2018
title="关于"
2119
class="about__dialog"
22-
:model-value="visible"
20+
:model-value="props.visible"
2321
width="30%"
2422
center
2523
@close="$emit('close')"

src/components/CodemirrorEditor/CssEditor.vue

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
<script>
2-
export default {
3-
name: `CssEditor`,
4-
props: {
5-
showCssEditor: {
6-
type: Boolean,
7-
default: false,
8-
},
1+
<script setup>
2+
const props = defineProps({
3+
showCssEditor: {
4+
type: Boolean,
5+
default: false,
96
},
10-
}
7+
})
118
</script>
129

1310
<template>
1411
<transition enter-active-class="bounceInRight">
15-
<el-col v-show="showCssEditor" :span="8" class="cssEditor-wrapper h-full">
12+
<el-col v-show="props.showCssEditor" :span="8" class="cssEditor-wrapper h-full">
1613
<textarea
1714
id="cssEditor"
1815
type="textarea"

src/components/RunLoading.vue

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
1-
<script>
2-
import { mapState } from 'pinia'
1+
<script setup>
2+
import { onMounted, ref } from 'vue'
33
import { useStore } from '@/stores'
44
5-
export default {
6-
name: `RunLoading`,
7-
data() {
8-
return {
9-
loading: true,
10-
}
11-
},
12-
computed: {
13-
...mapState(useStore, {
14-
nightMode: ({ nightMode }) => nightMode,
15-
}),
16-
},
17-
mounted() {
18-
setTimeout(() => {
19-
this.loading = false
20-
}, 100)
21-
},
22-
}
5+
const loading = ref(true)
6+
7+
const nightMode = useStore().nightMode
8+
9+
onMounted(() => {
10+
setTimeout(() => {
11+
loading.value = false
12+
}, 100)
13+
})
2314
</script>
2415

2516
<template>

0 commit comments

Comments
 (0)