Skip to content

Commit a794263

Browse files
InsuaPanJiaChen
authored andcommitted
fix(Tinymce): When content is null,set content to '' to avoid error (PanJiaChen#732)
When get rich editor value(null) from backend,it will occur error ``` Error in nextTick: "TypeError: Cannot read property 'replace' of null" ``` So I set val to '' to avoid it
1 parent 31d9da8 commit a794263

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/Tinymce/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export default {
5050
watch: {
5151
value(val) {
5252
if (!this.hasChange && this.hasInit) {
53-
this.$nextTick(() => window.tinymce.get(this.tinymceId).setContent(val))
53+
this.$nextTick(() =>
54+
window.tinymce.get(this.tinymceId).setContent(val || ''))
5455
}
5556
}
5657
},

0 commit comments

Comments
 (0)