diff --git a/packages/uni-template-compiler/__tests__/compiler-mp-alipay.spec.js b/packages/uni-template-compiler/__tests__/compiler-mp-alipay.spec.js index 2c918ac05a822affc612d9567edff37acf4b69bb..6d016649a15876f4370a1eac92b7c00cb029c893 100644 --- a/packages/uni-template-compiler/__tests__/compiler-mp-alipay.spec.js +++ b/packages/uni-template-compiler/__tests__/compiler-mp-alipay.spec.js @@ -229,5 +229,10 @@ describe('mp:compiler-mp-alipay', () => { '', '' ) + + assertCodegen( + '', + '' + ) }) }) diff --git a/packages/uni-template-compiler/lib/mp.js b/packages/uni-template-compiler/lib/mp.js index a15c2fbc832817843357e18bb7efe54f8112ced9..67d0d9d6ed8e78ef39aaee7bec22bea92923657e 100644 --- a/packages/uni-template-compiler/lib/mp.js +++ b/packages/uni-template-compiler/lib/mp.js @@ -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', @@ -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,