banner、协议

This commit is contained in:
cxc
2022-07-21 17:29:19 +08:00
parent 4db5098aed
commit d1db4aa979
17 changed files with 2627 additions and 49 deletions

View File

@ -19,7 +19,14 @@
<script>
import "@wangeditor/editor/dist/css/style.css"; // 引入 css
import { onBeforeUnmount, ref, shallowRef, toRefs, watch } from "vue";
import {
onBeforeUnmount,
onMounted,
ref,
shallowRef,
toRefs,
watch,
} from "vue";
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
export default {
@ -49,11 +56,15 @@ export default {
type: String,
default: "default",
},
readonly: {
type: Boolean,
default: false,
},
},
setup(props, context) {
// 编辑器实例,必须用 shallowRef
const editorRef = shallowRef();
// console.log(editorRef.value.getAllMenuKeys());
// 内容 HTML
const valueHtml = ref("");
watch(
@ -84,11 +95,15 @@ export default {
placeholder: "请输入内容...",
autoFocus: props.focus,
maxLength: 140,
readOnly: props.readonly,
};
onMounted(() => {
// console.log(editorRef.value.getConfig());
});
// 组件销毁时,也及时销毁编辑器
onBeforeUnmount(() => {
const editor = editorRef.value;
if (editor == null) return;
editor.destroy();
});