//富文本配置
// 编辑器实例,必须用 shallowRef
const editorRef = shallowRef();
const toolbarConfig = {};、
// 上传图片
const editorConfig = {
MENU_CONF: {
uploadImage: {
server: "/pcapi/index/upload",
fieldName: "file",
methods: "post",
metaWithUrl: true,
onSuccess(file, res) {
console.log(`${file.name} 上传成功`, res);
},
customInsert(res, insertFn) {
console.log(res);
insertFn("https://c2c.kuxia.top" + res.url);
}
}
}
};
// 组件销毁时,也及时销毁编辑器
onBeforeUnmount(() => {
const editor = editorRef.value;
if (editor == null) return;
editor.destroy();
});
const handleCreated = editor => {
editorRef.value = editor; // 记录 editor 实例,重要!
};
// 如果接口需要转成base64
introduce(参数名): Base64.encode(ruleForm.introduce)