Evan You 10 лет назад
Родитель
Сommit
fd6944a597

+ 3 - 2
src/platforms/web/compiler/directives/html.js

@@ -3,6 +3,7 @@
 import { addProp } from 'compiler/helpers'
 
 export default function html (el: ASTElement, dir: ASTDirective) {
-  if (!dir.value) return
-  addProp(el, 'innerHTML', `__toString__(${dir.value})`)
+  if (dir.value) {
+    addProp(el, 'innerHTML', `__toString__(${dir.value})`)
+  }
 }

+ 3 - 2
src/platforms/web/compiler/directives/text.js

@@ -3,6 +3,7 @@
 import { addProp } from 'compiler/helpers'
 
 export default function text (el: ASTElement, dir: ASTDirective) {
-  if (!dir.value) return
-  addProp(el, 'textContent', `__toString__(${dir.value})`)
+  if (dir.value) {
+    addProp(el, 'textContent', `__toString__(${dir.value})`)
+  }
 }