diff --git a/packages/uni-mp-compiler/__tests__/component.spec.ts b/packages/uni-mp-compiler/__tests__/component.spec.ts
index 659e16e5299eb74b56aa38a0ce80bbaaa85cfcba..c8deb08567a2ffdd2fd545e74e75faa4061484a5 100644
--- a/packages/uni-mp-compiler/__tests__/component.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/component.spec.ts
@@ -99,10 +99,10 @@ 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: _o($event => _ctx.j = $event), h: _o($event => _ctx.k = $event), i: _p({ ['prop-a']: 'l', ['prop-b']: _ctx.m, first: _ctx.j, last: _ctx.k }) }
+ 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/__tests__/vFor.spec.ts b/packages/uni-mp-compiler/__tests__/vFor.spec.ts
index 02fa19437fd36eb3db848dd6ca0b3b6fb1375245..0d21865c12fdb135bf1ec4d937e001b91e4ab94f 100644
--- a/packages/uni-mp-compiler/__tests__/vFor.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/vFor.spec.ts
@@ -186,18 +186,18 @@ describe(`compiler: v-for`, () => {
test(`keyed v-for`, () => {
assert(
``,
- ``,
+ ``,
`(_ctx, _cache) => {
- return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: item }; }) }
}`
)
})
test(`keyed template v-for`, () => {
assert(
`hello`,
- `hello`,
+ `hello`,
`(_ctx, _cache) => {
- return { a: _f(_ctx.items, (item, k0, i0) => { return {}; }) }
+ return { a: _f(_ctx.items, (item, k0, i0) => { return { a: item }; }) }
}`
)
})
diff --git a/packages/uni-mp-compiler/src/transforms/transformComponent.ts b/packages/uni-mp-compiler/src/transforms/transformComponent.ts
index 02164e33fbd96297c10673b10327829d08338480..97eeb1372f428afdc0280a6db2d4ee804688089e 100644
--- a/packages/uni-mp-compiler/src/transforms/transformComponent.ts
+++ b/packages/uni-mp-compiler/src/transforms/transformComponent.ts
@@ -103,6 +103,8 @@ function isComponentProp(name: string) {
'onVI',
'ref',
'slot',
+ 'key',
+ 'is',
].includes(name)
) {
return false
diff --git a/packages/uni-mp-compiler/src/transforms/transformIdentifier.ts b/packages/uni-mp-compiler/src/transforms/transformIdentifier.ts
index 2b0214e1f456348e6764a34f7915075d20a96f6d..7986f3143006442cf51a543594ba7f0e873130be 100644
--- a/packages/uni-mp-compiler/src/transforms/transformIdentifier.ts
+++ b/packages/uni-mp-compiler/src/transforms/transformIdentifier.ts
@@ -6,9 +6,7 @@ import {
} from '@vue/compiler-core'
import { NodeTransform } from '../transform'
-import { isForElementNode } from './vFor'
import { ATTR_VUE_SLOTS, rewriteExpression } from './utils'
-import { isSelfKey, rewriteSelfKey } from './transformKey'
import {
findStaticClassIndex,
isClassBinding,
@@ -44,8 +42,6 @@ export const transformIdentifier: NodeTransform = (node, context) => {
} else if (isSlotOutlet(node)) {
rewriteSlot(node, context)
} else if (node.type === NodeTypes.ELEMENT) {
- const vFor = isForElementNode(node) && node.vFor
-
let hasClassBinding = false
let hasStyleBinding = false
@@ -78,8 +74,6 @@ export const transformIdentifier: NodeTransform = (node, context) => {
if (exp) {
if (isBuiltIn(dir)) {
// noop
- } else if (isSelfKey(dir, vFor)) {
- rewriteSelfKey(dir)
} else if (isClassBinding(dir)) {
hasClassBinding = true
rewriteClass(i, dir, props, context)