最近公司的一个vue2的项目需要用到百度UEditor富文本编辑器。在集成进来的过程中遇到点路径问题,资源目录没法访问,项目目录截图
模板和资源文件目录
//组件百度编辑器
<template>
<div ref="editor"></div>
</template>
<script>
/* eslint-disable */
import '../../assets/ueditor/ueditor.config';
import '../../assets/ueditor/ueditor.all';
import '../../assets/ueditor/lang/zh-cn/zh-cn';
export default {
name:"ueditor",
data() {
return {
id: Math.random().toString(16).substring(2) + 'ueditorId',
};
},
props: {
value: {
type: String,
default: null,
},
config: {
type: Object,
default: {},
}
},
watch: {
value: function value(val, oldVal) {
this.editor = UE.getEditor(this.id, this.config);
if (val !== null) {
this.editor.setContent(val);
}
},
},
mounted() {
this.$nextTick(function f1() {
// 保证 this.$el 已经插入文档
this.$refs.editor.id = this.id;
this.editor = UE.getEditor(this.id, this.config);
this.editor.ready(function f2() {
this.editor.setContent(this.value);
this.editor.addListener("contentChange", function () {
const wordCount = this.editor.getContentLength(true);
const content = this.editor.getContent();
const plainTxt = this.editor.getPlainTxt();
this.$emit('input', { wordCount: wordCount, content: content, plainTxt: plainTxt });
}.bind(this));
this.$emit('ready', this.editor);
}.bind(this));
});
},
};
</script>
<style>
body{
background-color:#ff0000;
}
</style>
//注册全局组件名称
//引用组件
//结果就报错了
本地的资源目录 全部无法访问,我也修改了配置文件
请问下vue的大神们有用过这个么 有遇到过相似问题么?希望大神们 指点下 感激不尽
应该还是你路径问题吧 他是从项目根目录开始 我是放在static下的

去掉appAdmin 然后下面就是引进对应其他静态资源 应该就好办了