mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-04-24 23:47:17 +08:00
perf: bug
This commit is contained in:
parent
af0815c004
commit
6e6d743899
@ -2,23 +2,30 @@
|
|||||||
import "@wangeditor/editor/dist/css/style.css";
|
import "@wangeditor/editor/dist/css/style.css";
|
||||||
import { IEditorConfig } from "@wangeditor/editor";
|
import { IEditorConfig } from "@wangeditor/editor";
|
||||||
import { Editor } from "@wangeditor/editor-for-vue";
|
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({
|
defineOptions({
|
||||||
name: "BaseEditor"
|
name: "BaseEditor"
|
||||||
});
|
});
|
||||||
|
|
||||||
const content = defineModel<string>("content");
|
const content = defineModel<Generator>("content");
|
||||||
console.log("content", content);
|
|
||||||
|
|
||||||
const mode = "default";
|
const mode = "default";
|
||||||
// 编辑器实例,必须用 shallowRef
|
// 编辑器实例,必须用 shallowRef
|
||||||
const editorRef = shallowRef();
|
const editorRef = shallowRef();
|
||||||
|
|
||||||
// 内容 HTML
|
// 内容 HTML
|
||||||
const valueHtml =
|
const valueHtml = ref("");
|
||||||
'<pre><code class="language-java">' + content.value + "</code></pre>";
|
|
||||||
const editorConfig: Partial<IEditorConfig> = { MENU_CONF: {} };
|
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 => {
|
const handleCreated = editor => {
|
||||||
// 记录 editor 实例,重要!
|
// 记录 editor 实例,重要!
|
||||||
editorRef.value = editor;
|
editorRef.value = editor;
|
||||||
|
@ -25,6 +25,6 @@ onMounted(() => {
|
|||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<Base v-model:content="datas[0].content" />
|
<Base v-model:content="datas[0]" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user