perf: bug

This commit is contained in:
pan 2024-03-19 18:13:04 +08:00
parent af0815c004
commit 6e6d743899
2 changed files with 13 additions and 6 deletions

View File

@ -2,23 +2,30 @@
import "@wangeditor/editor/dist/css/style.css";
import { IEditorConfig } from "@wangeditor/editor";
import { Editor } from "@wangeditor/editor-for-vue";
import { onBeforeUnmount, shallowRef } from "vue";
import { onMounted, onBeforeUnmount, shallowRef, ref } from "vue";
import { type Generator } from "@/api/generator/generator";
defineOptions({
name: "BaseEditor"
});
const content = defineModel<string>("content");
console.log("content", content);
const content = defineModel<Generator>("content");
const mode = "default";
// shallowRef
const editorRef = shallowRef();
// HTML
const valueHtml =
'<pre><code class="language-java">' + content.value + "</code></pre>";
const valueHtml = ref("");
const editorConfig: Partial<IEditorConfig> = { MENU_CONF: {} };
onMounted(() => {
console.log("content", content.value.content);
valueHtml.value =
'<pre><code class="language-java">' +
content.value.content +
"</code></pre>";
const editorConfig: Partial<IEditorConfig> = { MENU_CONF: {} };
});
const handleCreated = editor => {
// editor
editorRef.value = editor;

View File

@ -25,6 +25,6 @@ onMounted(() => {
{{ item.name }} &nbsp;
</span>
<Base v-model:content="datas[0].content" />
<Base v-model:content="datas[0]" />
</div>
</template>