mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
add preserveWhitespace option
This commit is contained in:
parent
8f5a69be8a
commit
e094b00c2e
@ -1,3 +1,4 @@
|
||||
import config from '../config'
|
||||
import { parseText } from './text-parser'
|
||||
import { isArray } from '../util/index'
|
||||
|
||||
@ -25,7 +26,7 @@ function genElement (el, key) {
|
||||
}
|
||||
|
||||
function genIf (el, exp) {
|
||||
return `(${exp}) ? ${genElement(el)} : ''`
|
||||
return `(${exp}) ? ${genElement(el)} : null`
|
||||
}
|
||||
|
||||
function genFor (el, exp) {
|
||||
@ -101,7 +102,6 @@ function genData (el, key) {
|
||||
if (hasEvents) {
|
||||
data += genEvents(events)
|
||||
}
|
||||
console.log(data)
|
||||
return data.replace(/,$/, '') + '}'
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
import config from '../config'
|
||||
|
||||
/**
|
||||
* Convert HTML string to AST
|
||||
*
|
||||
@ -37,8 +39,14 @@ export function parse (html) {
|
||||
chars (text) {
|
||||
text = currentParent.tag === 'pre'
|
||||
? text
|
||||
: text.trim() ? text : ' '
|
||||
currentParent.children.push(text)
|
||||
: text.trim()
|
||||
? text
|
||||
: config.preserveWhiteSpace
|
||||
? ' '
|
||||
: null
|
||||
if (text) {
|
||||
currentParent.children.push(text)
|
||||
}
|
||||
}
|
||||
})
|
||||
return root
|
||||
|
@ -1,13 +1,10 @@
|
||||
export default {
|
||||
|
||||
/**
|
||||
* Whether to print debug messages.
|
||||
* Also enables stack trace for warnings.
|
||||
*
|
||||
* @type {Boolean}
|
||||
* Preserve whitespaces between elements.
|
||||
*/
|
||||
|
||||
debug: false,
|
||||
preserveWhiteSpace: true,
|
||||
|
||||
/**
|
||||
* Whether to suppress warnings.
|
||||
@ -17,12 +14,6 @@ export default {
|
||||
|
||||
silent: false,
|
||||
|
||||
/**
|
||||
* Whether to use async rendering.
|
||||
*/
|
||||
|
||||
async: true,
|
||||
|
||||
/**
|
||||
* Whether to warn against errors caught when evaluating
|
||||
* expressions.
|
||||
@ -30,22 +21,6 @@ export default {
|
||||
|
||||
warnExpressionErrors: true,
|
||||
|
||||
/**
|
||||
* Whether to allow devtools inspection.
|
||||
* Disabled by default in production builds.
|
||||
*/
|
||||
|
||||
devtools: process.env.NODE_ENV !== 'production',
|
||||
|
||||
/**
|
||||
* Internal flag to indicate the delimiters have been
|
||||
* changed.
|
||||
*
|
||||
* @type {Boolean}
|
||||
*/
|
||||
|
||||
_delimitersChanged: true,
|
||||
|
||||
/**
|
||||
* List of asset types that a component can own.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user