Kaynağa Gözat

only preserve whitespace if it is not right after starting tag

Evan You 10 yıl önce
ebeveyn
işleme
e223b87bd3
1 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  1. 2 1
      src/compiler/parser/index.js

+ 2 - 1
src/compiler/parser/index.js

@@ -112,7 +112,8 @@ export function parse (template, preserveWhitespace) {
       }
       text = currentParent.tag === 'pre' || text.trim()
         ? decodeHTML(text)
-        : preserveWhitespace ? ' ' : null
+        // only preserve whitespace if its not right after a starting tag
+        : preserveWhitespace && currentParent.children.length ? ' ' : null
       if (text) {
         let expression
         if (text !== ' ' && (expression = parseText(text))) {