<已解决>富文本编辑器wangEdiotr,编辑内容后,重新打开报错Uncaught (in promise) Error: Cannot find a descendant at path

最近用wangEdiotr的时候,会触及到一个页面会用到了两个编辑框来回切换的效果,文字会多切换回显会报错,网上搜了很多方法没解决,突然想起来了以前使用img解决的方法就是添加一个key值,就可以解决,

 

 <WangEditor v-model:detail="selectedContent" :height="'380px'" :key="selectedContent" />

我的selectedContent绑定的是计算属性,因为会切换数据。

const selectedContent = computed({
    get: () => {
        if (state.selected >= 0 && state.selected < state.hospitalInfo.otherInfoList?.length) {
            return state.hospitalInfo.otherInfoList[state.selected].content;
        }
        return ""
    },
    set: (value) => {
        if (state.selected >= 0 && state.selected < state.hospitalInfo.otherInfoList?.length) {
            state.hospitalInfo.otherInfoList[state.selected].content = value;
        }
    },
})

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
要在Spring Boot中整合WangEditor富文本编辑器,可以按照以下步骤进行操作: 1. 在pom.xml文件中添加以下依赖: ```xml <!--wangEditor富文本编辑器--> <dependency> <groupId>com.github.wangfengtao</groupId> <artifactId>wangeditor-spring-boot-starter</artifactId> <version>1.4.4</version> </dependency> ``` 2. 创建一个Controller,并添加一个返回WangEditor的接口: ```java @RestController @RequestMapping("/editor") public class EditorController { @GetMapping("/wangeditor") public ModelAndView wangeditor() { return new ModelAndView("editor"); } } ``` 其中,`editor`是一个HTML模板文件,用于展示WangEditor富文本编辑器。 3. 在`resources/templates`目录下创建`editor.html`文件,代码如下: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>WangEditor富文本编辑器</title> <!-- 引入wangEditor的CSS文件 --> <link rel="stylesheet" type="text/css" href="/webjars/wangeditor/4.5.1/css/wangEditor.min.css"/> </head> <body> <textarea id="editor" name="content"></textarea> <!-- 引入wangEditor的JS文件 --> <script type="text/javascript" src="/webjars/wangeditor/4.5.1/js/wangEditor.min.js"></script> <script type="text/javascript"> // 创建富文本编辑器 var editor = new wangEditor('#editor'); editor.create(); </script> </body> </html> ``` 4. 启动应用程序,并在浏览器中访问`http://localhost:8080/editor/wangeditor`,即可看到WangEditor富文本编辑器。 以上就是在Spring Boot中整合WangEditor富文本编辑器的步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值