From a7942636c6084ed72fadc5a75c48f4f2ac2babe8 Mon Sep 17 00:00:00 2001
From: Insua <insua@sohu.com>
Date: Fri, 1 Jun 2018 15:38:08 +0800
Subject: [PATCH] fix(Tinymce): When content is null,set content to '' to avoid
 error (#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
---
 src/components/Tinymce/index.vue | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/components/Tinymce/index.vue b/src/components/Tinymce/index.vue
index 52356249..6ab60848 100644
--- a/src/components/Tinymce/index.vue
+++ b/src/components/Tinymce/index.vue
@@ -50,7 +50,8 @@ export default {
   watch: {
     value(val) {
       if (!this.hasChange && this.hasInit) {
-        this.$nextTick(() => window.tinymce.get(this.tinymceId).setContent(val))
+        this.$nextTick(() =>
+          window.tinymce.get(this.tinymceId).setContent(val || ''))
       }
     }
   },
-- 
GitLab