Skip to content

Commit

Permalink
fix:(mp-alipay): 支付宝小程序平台增加独有内置组件判断 #2410#issuecomment-878974559
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed Jul 15, 2021
1 parent 668e001 commit 92d682a
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,10 @@ describe('mp:compiler-mp-alipay', () => {
'<movable-view @changeend="changeEnd"/>',
'<movable-view data-event-opts="{{[[\'changeEnd\',[[\'changeEnd\',[\'$event\']]]]]}}" onChangeEnd="__e"></movable-view>'
)

assertCodegen(
'<life-follow @close="close"/>',
'<life-follow data-event-opts="{{[[\'close\',[[\'close\',[\'$event\']]]]]}}" onClose="__e"></life-follow>'
)
})
})
104 changes: 56 additions & 48 deletions packages/uni-template-compiler/lib/mp.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,62 @@
const EVENTS = {
click: 'tap'
}
const tags = [
'slot',
'block',
'component',
'template',
const tags = {
// 小程序平台通用组件
base: [
'slot',
'block',
'component',
'template',

'ad',
'audio',
'button',
'camera',
'canvas',
'checkbox',
'checkbox-group',
'cover-image',
'cover-view',
'form',
'functional-page-navigator',
'icon',
'image',
'input',
'label',
'live-player',
'live-pusher',
'map',
'movable-area',
'movable-view',
'navigator',
'official-account',
'open-data',
'picker',
'picker-view',
'picker-view-column',
'progress',
'radio',
'radio-group',
'rich-text',
'scroll-view',
'slider',
'swiper',
'swiper-item',
'switch',
'text',
'textarea',
'video',
'view',
'web-view',
'editor'
]
'ad',
'audio',
'button',
'camera',
'canvas',
'checkbox',
'checkbox-group',
'cover-image',
'cover-view',
'form',
'functional-page-navigator',
'icon',
'image',
'input',
'label',
'live-player',
'live-pusher',
'map',
'movable-area',
'movable-view',
'navigator',
'official-account',
'open-data',
'picker',
'picker-view',
'picker-view-column',
'progress',
'radio',
'radio-group',
'rich-text',
'scroll-view',
'slider',
'swiper',
'swiper-item',
'switch',
'text',
'textarea',
'video',
'view',
'web-view',
'editor',
],
// 支付宝小程序平台独有组件
'mp-alipay': [
'lifestyle',
'life-follow'
]
}

const baseCompiler = {
ref: 'data-ref',
Expand All @@ -60,7 +68,7 @@ const baseCompiler = {
* 目前 template 在前,script 在后,要做的话,就需要把 wxml 的生成机制放到 plugin 中才可以拿到真实的组件列表
*/
isComponent (tagName) {
return !tags.includes(tagName)
return !tags.base.concat(tags[this.name] || []).includes(tagName)
},
createFilterTag (filterTag, {
content,
Expand Down

0 comments on commit 92d682a

Please sign in to comment.