hookehuyr

🐞 fix: 富文本控件获取数据优化

1 <!-- 1 <!--
2 * @Date: 2022-09-26 21:52:25 2 * @Date: 2022-09-26 21:52:25
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-18 18:43:55 4 + * @LastEditTime: 2022-10-26 11:31:30
5 * @FilePath: /swx/src/components/activity-editor.vue 5 * @FilePath: /swx/src/components/activity-editor.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -64,20 +64,20 @@ export default { ...@@ -64,20 +64,20 @@ export default {
64 editorCtx: '' 64 editorCtx: ''
65 } 65 }
66 }, 66 },
67 + watch: {
68 + htmlContent (val) {
69 + // 如果有传值,还原重新编辑
70 + this.editorCtx.setContents({
71 + html: val
72 + })
73 + }
74 + },
67 methods: { 75 methods: {
68 _onEditorReady: function () { 76 _onEditorReady: function () {
69 const that = this; 77 const that = this;
70 Taro.createSelectorQuery().select('#editor').context(function (res) { 78 Taro.createSelectorQuery().select('#editor').context(function (res) {
71 that.editorCtx = res.context 79 that.editorCtx = res.context
72 }).exec(); 80 }).exec();
73 - // 如果有传值,还原重新编辑
74 - if (this.htmlContent) {
75 - setTimeout(() => {
76 - this.editorCtx.setContents({
77 - html: this.htmlContent
78 - })
79 - }, 1000);
80 - }
81 }, 81 },
82 //插入图片 82 //插入图片
83 _addImage: function (event) { 83 _addImage: function (event) {
......