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 f1741249d5d2dc2f310517c6d93f5c54dda1cce5..b303df5a2a3e20f2a9b03e927abbb9078882434f 100644 --- a/packages/uni-template-compiler/__tests__/compiler-mp-alipay.spec.js +++ b/packages/uni-template-compiler/__tests__/compiler-mp-alipay.spec.js @@ -126,8 +126,8 @@ describe('mp:compiler-mp-alipay', () => { it('generate events with v-on directive', () => { assertCodegen( '', - '', - 'with(this){var a0={color:"#4cd964",size:"22",type:"spinner"};$mp.data=Object.assign({},{$root:{a0:a0}})}' + '', + 'with(this){}' ) assertCodegen( 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 04b2448e230d177b6eb3dc919a1deee51be1ead0..913a31991aa68a94bf3150dd92db9fd38a3d02c5 100644 --- a/packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js +++ b/packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js @@ -130,5 +130,6 @@ describe('mp:compiler-mp-weixin', () => { '', '' ) + assertCodegen('', '') }) }) diff --git a/packages/uni-template-compiler/lib/script/traverse/data/attrs.js b/packages/uni-template-compiler/lib/script/traverse/data/attrs.js index 99bff684b37355381638c7995e6f23d27f6440fa..7a153581f6c60ce65be4f64b1abf86f7376dfade 100644 --- a/packages/uni-template-compiler/lib/script/traverse/data/attrs.js +++ b/packages/uni-template-compiler/lib/script/traverse/data/attrs.js @@ -1,18 +1,19 @@ -const { - IDENTIFIER_ATTR -} = require('../../../constants') +// const { +// IDENTIFIER_ATTR +// } = require('../../../constants') -const getMemberExpr = require('../member-expr') +// const getMemberExpr = require('../member-expr') module.exports = function processAttrs (paths, path, state, isComponent, tagName) { - const attrsPath = paths.attrs - if (attrsPath) { - attrsPath.get('value.properties').forEach(propertyPath => { - const valuePath = propertyPath.get('value') - if (valuePath.isObjectExpression()) { - valuePath.replaceWith(getMemberExpr(null, IDENTIFIER_ATTR, valuePath.node, state)) - } - }) - } + // 不再单独处理ObjectExpression,改为在转换temlplte时用()包裹(微信、QQ) + // const attrsPath = paths.attrs + // if (attrsPath) { + // attrsPath.get('value.properties').forEach(propertyPath => { + // const valuePath = propertyPath.get('value') + // if (valuePath.isObjectExpression()) { + // valuePath.replaceWith(getMemberExpr(null, IDENTIFIER_ATTR, valuePath.node, state)) + // } + // }) + // } return [] -} +}