Skip to content

Commit

Permalink
fix(quickapp): 快应用支持 Block 标签,close #3686
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jul 8, 2019
1 parent 697c74b commit 2dfeafe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/taro-cli/src/mini/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

export const QUICKAPP_SPECIAL_COMPONENTS = new Set<string>([
'View',
'Text'
'Text',
'Block'
])
10 changes: 8 additions & 2 deletions packages/taro-transformer-wx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,15 @@ export default function transform (options: Options): TransformResult {
}
}
}
if (name === 'View' && Adapter.type === Adapters.quickapp) {
path.node.name = t.jSXIdentifier('div')
if (Adapter.type === Adapters.quickapp) {
if (name === 'View') {
path.node.name = t.jSXIdentifier('div')
}
if (name === 'Block') {
path.node.name = t.jSXIdentifier('block')
}
}

if (name === 'Provider') {
const modules = path.scope.getAllBindings('module')
const providerBinding = Object.values(modules).some((m: Binding) => m.identifier.name === 'Provider')
Expand Down

0 comments on commit 2dfeafe

Please sign in to comment.