|
|
@@ -1,6 +1,6 @@
|
|
|
/* @flow */
|
|
|
|
|
|
-import { addAttr } from 'compiler/helpers'
|
|
|
+import { transformText } from './text'
|
|
|
|
|
|
let currentRecycleList = null
|
|
|
|
|
|
@@ -20,9 +20,7 @@ function postTransformNode (el: ASTElement) {
|
|
|
if (currentRecycleList) {
|
|
|
// <text>: transform children text into value attr
|
|
|
if (el.tag === 'text') {
|
|
|
- addAttr(el, 'value', genText(el.children[0]))
|
|
|
- el.children = []
|
|
|
- el.plain = false
|
|
|
+ transformText(el)
|
|
|
}
|
|
|
}
|
|
|
if (el === currentRecycleList) {
|
|
|
@@ -30,17 +28,6 @@ function postTransformNode (el: ASTElement) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function genText (node) {
|
|
|
- const value = node.type === 3
|
|
|
- ? node.text
|
|
|
- : node.type === 2
|
|
|
- ? node.tokens.length === 1
|
|
|
- ? node.tokens[0]
|
|
|
- : node.tokens
|
|
|
- : ''
|
|
|
- return JSON.stringify(value)
|
|
|
-}
|
|
|
-
|
|
|
export default {
|
|
|
preTransformNode,
|
|
|
transformNode,
|