2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-06 03:47:17 +08:00

fix: 修复编辑器无法加载文件内容

This commit is contained in:
耗子
2025-02-12 03:02:17 +08:00
parent 7ac448d2c4
commit e614e97312
2 changed files with 5 additions and 5 deletions

View File

@@ -16,12 +16,12 @@ const props = defineProps({
})
const disabled = ref(false) // 在出现错误的情况下禁用保存
const data = ref('')
const content = ref('')
const get = () => {
useRequest(file.content(props.path))
.onSuccess(({ data }) => {
data.value = decodeBase64(data.content)
content.value = decodeBase64(data.content)
window.$message.success('获取成功')
})
.onError(() => {
@@ -34,7 +34,7 @@ const save = () => {
window.$message.error('当前状态下不可保存')
return
}
useRequest(file.save(props.path, data.value)).onSuccess(() => {
useRequest(file.save(props.path, content.value)).onSuccess(() => {
window.$message.success('保存成功')
})
}
@@ -51,7 +51,7 @@ defineExpose({
<template>
<Editor
v-model:value="data"
v-model:value="content"
:language="languageByPath(props.path)"
theme="vs-dark"
height="60vh"

View File

@@ -20,7 +20,7 @@ async function setupApp() {
const app = createApp(App)
app.use(VueMonacoEditorPlugin, {
paths: {
vs: '/assets/vs'
vs: window.location.origin + '/assets/vs'
},
'vs/nls': {
availableLanguages: { '*': 'zh-cn' }