<已解决>富文本编辑器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;
        }
    },
})

  • 6
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值