From 2ccff887c2c311f798c4e1c49ace0105b6027f97 Mon Sep 17 00:00:00 2001 From: yuche Date: Wed, 31 Oct 2018 18:35:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(taroize):=20=E6=AD=A3=E5=88=99=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=8C=B9=E9=85=8D=20...=20=E8=AF=AD=E6=B3=95=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taroize/src/wxml.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/taroize/src/wxml.ts b/packages/taroize/src/wxml.ts index 8122bf264c75..1a7ab7df1053 100644 --- a/packages/taroize/src/wxml.ts +++ b/packages/taroize/src/wxml.ts @@ -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)) { @@ -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 }