Skip to content

Commit

Permalink
feat(transformer): 没有找到返回 JSX 元素提示是否缺少 return, #3334
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Jun 6, 2019
1 parent 29225c6 commit 8d2f989
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/taro-transformer-wx/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2070,6 +2070,9 @@ export class RenderParser {
}
this.finalReturnElement.openingElement.attributes.push(...attrs)
}
if (!this.finalReturnElement) {
throw codeFrameError(this.renderPath.node, '没有找到返回的 JSX 元素,你是不是忘记 return 了?')
}
this.outputTemplate = parseJSXElement(this.finalReturnElement, true)
if (!this.isDefaultRender) {
this.outputTemplate = `<template name="${this.renderMethodName}">${this.outputTemplate}</template>`
Expand Down

0 comments on commit 8d2f989

Please sign in to comment.