editor渲染失败
发布于 4 年前 作者 jingyi 4987 次浏览 来自 分享

editor获取数据异步的,editor组件的ready事件渲染时,渲染的数据还没有获取到导致渲染失败。

1.本页面中的editor 直接把ready事件保存的

	that.editorCtx = res.context

变量在获取数据的事件中调用 that.editorCtx

2.如果是 组件中使用 editor

数据是propperties的 可以用 obsservers 监听这个值,然后渲染 
 observers: {
    'editData'function(editData{
      let that = this
      if(that.editorCtx){
        that.editorCtx.setContents({
          deltaJSON.parse(that.data.editData),
          successfunction (res{
            console.log("渲染成功")
          },
          failfunction (err{
            console.log("渲染失败")
          }
        })
      }
    }
  },
回到顶部