diff --git a/packages/uni-template-compiler/__tests__/compiler-mp-baidu.spec.js b/packages/uni-template-compiler/__tests__/compiler-mp-baidu.spec.js
index 4d719a64ee2afe35ca461e177d50f4e64d5a6eb6..511ad13b11d020051d0c36c4bd651af15d64683f 100644
--- a/packages/uni-template-compiler/__tests__/compiler-mp-baidu.spec.js
+++ b/packages/uni-template-compiler/__tests__/compiler-mp-baidu.spec.js
@@ -15,6 +15,12 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt
}
describe('mp:compiler-mp-baidu', () => {
+ it('generate component', () => {
+ assertCodegen(
+ '',
+ ''
+ )
+ })
it('generate class', () => {
assertCodegen(
'hello world',
@@ -75,40 +81,35 @@ describe('mp:compiler-mp-baidu', () => {
assertCodegen(
'{{item}}',
'{{item}}',
- 'with(this){}',
- {
+ 'with(this){}', {
scopedSlotsCompiler: 'auto'
}
)
assertCodegen(
'{{getValue(item)}}',
'{{$root.m1}}',
- 'with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default","item")):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}',
- {
+ 'with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default","item")):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}', {
scopedSlotsCompiler: 'auto'
}
)
assertCodegen(
'{{getValue(item.text)}}',
'{{$root.m1}}',
- 'with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default").text):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}',
- {
+ 'with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?getValue($getScopedSlotsParams("551070e6-1","default").text):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}', {
scopedSlotsCompiler: 'auto'
}
)
assertCodegen(
'',
'',
- 'with(this){if($scope.data.scopedSlotsCompiler==="augmented"){$setScopedSlotsParams("default",{"item":item})}}',
- {
+ 'with(this){if($scope.data.scopedSlotsCompiler==="augmented"){$setScopedSlotsParams("default",{"item":item})}}', {
scopedSlotsCompiler: 'auto'
}
)
assertCodegen(
'',
'',
- 'with(this){if($scope.data.scopedSlotsCompiler==="augmented"){$setScopedSlotsParams("default",object)}}',
- {
+ 'with(this){if($scope.data.scopedSlotsCompiler==="augmented"){$setScopedSlotsParams("default",object)}}', {
scopedSlotsCompiler: 'auto'
}
)
@@ -156,4 +157,4 @@ describe('mp:compiler-mp-baidu', () => {
'{{"我是第一行3\\\\n 我的第二行2"+title}}'
)
})
-})
+})
diff --git a/packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js b/packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
index 44eec7dbd7f5613e80ca8cb37b04d460bbeaa8ed..44ae404f7840fbe72c8df25045a97da73db42df5 100644
--- a/packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
+++ b/packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
@@ -272,7 +272,7 @@ describe('mp:compiler-mp-weixin', () => {
it('generate page-meta', () => {
assertCodegen( // TODO vue-id
'',
- ''
+ ''
)
})
diff --git a/packages/uni-template-compiler/lib/mp.js b/packages/uni-template-compiler/lib/mp.js
index f5c068e2bef9e8024650d285edb56f2a76862621..2a1eeb1ee316563e5cf4f6d2c6028d458bfcecf9 100644
--- a/packages/uni-template-compiler/lib/mp.js
+++ b/packages/uni-template-compiler/lib/mp.js
@@ -53,6 +53,16 @@ const tags = {
'web-view',
'editor'
],
+ 'mp-baidu': [
+ 'follow-swan',
+ 'login',
+ 'inline-payment-panel'
+ ],
+ 'mp-weixin': [
+ 'page-meta',
+ 'navigation-bar',
+ 'match-media'
+ ],
// 支付宝小程序平台独有组件
'mp-alipay': [
'lifestyle',
@@ -111,7 +121,9 @@ ${content}
return `${eventType}${eventName}` // 原生组件不支持 bind:input 等写法,统一使用 bindinput
},
createScopedSlots (slotName, props, state) {
- state.errors.add(uniI18n.__('templateCompiler.notCurrentlySupportScopedSlot', { 0: `[${slotName}]` }))
+ state.errors.add(uniI18n.__('templateCompiler.notCurrentlySupportScopedSlot', {
+ 0: `[${slotName}]`
+ }))
return {
type: 'slot',
attr: {
@@ -124,7 +136,9 @@ ${content}
traverseExpr,
normalizeChildren
}, state) {
- state.errors.add(uniI18n.__('templateCompiler.notCurrentlySupportScopedSlot', { 0: `[${slotName}]` }))
+ state.errors.add(uniI18n.__('templateCompiler.notCurrentlySupportScopedSlot', {
+ 0: `[${slotName}]`
+ }))
return {
type: 'view',
attr: {
@@ -146,4 +160,4 @@ module.exports = function getCompilerOptions (platform) {
baseCompiler,
require(id + '/lib/uni.compiler.js')
)
-}
+}