Skip to content

Commit

Permalink
fix(taroize): 正则无法匹配 ... 语法失败
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche authored and luckyadam committed Nov 19, 2018
1 parent ad9340c commit 2ccff88
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/taroize/src/wxml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,6 @@ function parseNode (node: AllKindNode) {
return parseElement(node)
}

const expressionRE = /(?<=\(\.\.\.).+(?=(\)))/g

function parseElement (element: Element): t.JSXElement {
const tagName = t.jSXIdentifier(allCamelCase(element.tagName))
if (DEFAULT_Component_SET.has(tagName.name)) {
Expand All @@ -445,8 +443,8 @@ function parseElement (element: Element): t.JSXElement {
const content = parseContent(value)
if (content.type === 'expression') {
isSpread = true
const expression = expressionRE.exec(content.content)
attr.value = expression ? `{{${expression[0]}}}` : attr.value
const str = content.content
attr.value = `{{${str.slice(str.includes('...') ? 4 : 1 , str.length - 1)}}}`
} else {
attr.value = content.content
}
Expand Down

0 comments on commit 2ccff88

Please sign in to comment.