feat: 更新项目配置和依赖,增强功能和用户体验

- 完成弹幕机功能
- 在 .editorconfig 中新增对 vine.ts 文件的支持。
- 更新 package.json 中多个依赖的版本,提升稳定性和性能。
- 在 vite.config.mts 中引入 @guolao/vue-monaco-editor 插件,增强代码编辑功能。
- 在 App.vue 中调整内容填充的样式,优化界面布局。
- 新增获取配置文件哈希的 API 方法,提升配置管理能力。
- 在多个组件中优化了样式和逻辑,提升用户交互体验。
This commit is contained in:
2025-04-25 00:08:06 +08:00
parent b24974540f
commit 07948e6777
36 changed files with 3108 additions and 1258 deletions

View File

@@ -2,12 +2,13 @@
<div
ref="editorContainer"
:style="`height: ${height}px;`"
/>
</template>
<script setup lang="ts">
import { editor } from 'monaco-editor'; // 全部导入
import { ref, onMounted } from 'vue';
import { ref, onMounted, onBeforeUnmount, watch } from 'vue';
const value = defineModel<string>('value')
@@ -16,10 +17,13 @@ const { language, height = 400 } = defineProps<{
height?: number
}>()
const editorContainer = ref()
const editorContainer = ref<HTMLElement>()
let editorInstance: editor.IStandaloneCodeEditor | null = null
onMounted(() => {
const e = editor.create(editorContainer.value, {
if (!editorContainer.value) return
editorInstance = editor.create(editorContainer.value, {
value: value.value,
language: language,
minimap: {
@@ -28,8 +32,36 @@ onMounted(() => {
colorDecorators: true,
automaticLayout: true
})
e.onDidChangeModelContent(() => {
value.value = e.getValue()
editorInstance.onDidChangeModelContent(() => {
if (editorInstance) {
const currentValue = editorInstance.getValue()
if (currentValue !== value.value) {
value.value = currentValue
}
}
})
})
onBeforeUnmount(() => {
if (editorInstance) {
editorInstance.dispose()
editorInstance = null
}
})
watch(value, (newValue) => {
if (editorInstance && newValue !== editorInstance.getValue()) {
editorInstance.setValue(newValue ?? '')
}
})
watch(() => language, (newLang) => {
if (editorInstance) {
const model = editorInstance.getModel()
if (model) {
editor.setModelLanguage(model, newLang)
}
}
})
</script>

View File

@@ -167,9 +167,7 @@ function onLoginButtonClick() {
refreshDate: Date.now()
}
message.success(`成功登陆为 ${data?.data.account.name}`)
setTimeout(() => {
location.reload()
}, 1000)
location.reload()
} else {
message.error(data.message)
}