From 3bd3286c3f4e77988b061c90d9d533c352ba36fe Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Wed, 12 Jan 2022 11:40:05 +0800 Subject: [PATCH] fix(mp): keep the id attribute (#3179) --- packages/uni-mp-compiler/__tests__/component.spec.ts | 4 ++-- packages/uni-mp-compiler/src/transforms/transformComponent.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/uni-mp-compiler/__tests__/component.spec.ts b/packages/uni-mp-compiler/__tests__/component.spec.ts index 5e981289d..642bf44ba 100644 --- a/packages/uni-mp-compiler/__tests__/component.spec.ts +++ b/packages/uni-mp-compiler/__tests__/component.spec.ts @@ -100,8 +100,8 @@ describe('compiler: transform component', () => { }) test(`component with props`, () => { assert( - ``, - ``, + ``, + ``, `(_ctx, _cache) => { return { a: _ctx.b, b: _ctx.d, c: _n(_ctx.f), d: _s(_ctx.h), e: _o(_ctx.i), f: _ctx.o, g: _ctx.r, h: _ctx.t, i: _o($event => _ctx.j = $event), j: _o($event => _ctx.k = $event), k: _p({ ['prop-a']: 'l', ['prop-b']: _ctx.m, first: _ctx.j, last: _ctx.k }) } }` diff --git a/packages/uni-mp-compiler/src/transforms/transformComponent.ts b/packages/uni-mp-compiler/src/transforms/transformComponent.ts index fd7d7d4ac..ec713aded 100644 --- a/packages/uni-mp-compiler/src/transforms/transformComponent.ts +++ b/packages/uni-mp-compiler/src/transforms/transformComponent.ts @@ -112,6 +112,7 @@ function processBooleanAttr({ props }: ComponentNode) { } const builtInProps = [ + 'id', 'class', 'style', ATTR_VUE_ID, -- GitLab