fix: 富文本组件增加 baseURL 设置

This commit is contained in:
lbw 2023-04-07 10:55:09 +08:00
parent ce008f9f71
commit ac57bc437a

View File

@ -20,6 +20,7 @@ import { reactive, shallowRef, watch, onBeforeUnmount } from 'vue';
import { IDomEditor } from '@wangeditor/editor';
import { Toolbar, Editor } from '@wangeditor/editor-for-vue';
import { Session } from '/@/utils/storage';
const { proxy } = getCurrentInstance();
//
const props = defineProps({
@ -50,7 +51,7 @@ const props = defineProps({
getText: String,
uploadFileUrl: {
type: String,
default: '/admin/sys-file/upload',
default: `/admin/sys-file/upload`,
},
});
@ -68,10 +69,10 @@ const headers = computed(() => {
//
const uploadAttr = reactive({
fieldName: 'file',
server: props.uploadFileUrl,
server: proxy.baseURL + props.uploadFileUrl,
headers: headers,
customInsert(res, insertFn) {
insertFn(res.data.url);
insertFn(proxy.baseURL + res.data.url);
},
});