1***@qq.com
1***@qq.com
  • 发布:2019-12-24 09:29
  • 更新:2021-01-12 11:03
  • 阅读:8830

uni-app 富文本编辑器editor 怎么赋值

分类:uni-app

一个页面内有多个富文本编辑器editor,怎么对应赋值,还有就是请问 this.editorCtx 这个从哪来的

2019-12-24 09:29 负责人:无 分享
已邀请:
深圳奥飞网络

深圳奥飞网络

复制代码<editor id="editor" class="ql-container" :placeholder="placeholder" @ready="onEditorReady"></editor>
复制代码onEditorReady(){    
    uni.createSelectorQuery().select('#editor').context((res) => {    
    this.editorCtx = res.context    
     this.editorCtx.setContents({    
                html:this.EditGoodsDetail.content    //this.EditGoodsDetail.content为赋值内容。    
        })    
    }).exec()    
}

相关链接:https://uniapp.dcloud.io/api/media/editor-context
如果有用麻烦点个赞

  • 即时通讯开发

    请问数据通过接口请求拿到的数据 @ready执行了 但是数据还没有请求出来,导致的异步怎么解决

    2020-04-23 14:56

2***@qq.com

2***@qq.com

在请求接口后,执行一次onEditorReady();就行了

复制代码if(res.code==1){  
     this.data = res.data;  
     this.onEditorReady()  
}

该问题目前已经被锁定, 无法添加新回复

  • 标题 / 粗斜体
  • 代码片段
  • 超链接 / 图片 / 视频
  • 列表 / 引用

文章内容较多时,可以用标题分段 :

## 大标题 
### 小标题

斜体 / 粗体 :

**粗体** 
*斜体*
***粗斜体***

代码片段 :

``` javascript
代码片段
```

超链接 :

[链接文字](链接地址) 例: [百度](http://www.baidu.com)

图片 :

![图片说明](图片地址) 例: ![百度logo](http://www.baidu.com/img/bdlogo.gif)

视频 :

!![视频说明](视频地址) 例: !![优酷视频](http://youku.com)

有序列表 :

1. 123
2. 123
3. 123

无序列表 :

- 123
- 123
- 123

引用 : ( 双回车后结束引用 )

> 引用内容
引用内容
引用内容