fix: skip normalizeObjectSlots in runtime-core

This commit is contained in:
Amour1688 2020-06-21 17:06:37 +08:00
parent 20f508e917
commit 74744fe74b

View File

@ -265,12 +265,12 @@ const buildProps = (t, path, state, hasContainer) => {
if ( if (
(patchFlag === 0 || patchFlag === PatchFlags.HYDRATE_EVENTS) (patchFlag === 0 || patchFlag === PatchFlags.HYDRATE_EVENTS)
&& hasRef && (hasRef || directives.length > 0)
) { ) {
patchFlag |= PatchFlags.NEED_PATCH; patchFlag |= PatchFlags.NEED_PATCH;
} }
let propsExpression; let propsExpression = t.nullLiteral();
if (mergeArgs.length) { if (mergeArgs.length) {
if (properties.length) { if (properties.length) {
@ -368,7 +368,9 @@ const transformJSXElement = (t, path, state) => {
const isComponent = checkIsComponent(t, path.get('openingElement')); const isComponent = checkIsComponent(t, path.get('openingElement'));
const child = children.length === 1 && t.isStringLiteral(children[0]) const child = children.length === 1 && t.isStringLiteral(children[0])
? children[0] : t.arrayExpression(children); ? children[0] : t.arrayExpression(children);
if (state.opts.compatibleProps && !state.get('compatibleProps')) {
const { compatibleProps } = state.opts;
if (compatibleProps && !state.get('compatibleProps')) {
state.set('compatibleProps', addDefault( state.set('compatibleProps', addDefault(
path, '@ant-design-vue/babel-helper-vue-compatible-props', { nameHint: '_compatibleProps' }, path, '@ant-design-vue/babel-helper-vue-compatible-props', { nameHint: '_compatibleProps' },
)); ));
@ -376,7 +378,7 @@ const transformJSXElement = (t, path, state) => {
const createVNode = t.callExpression(createIdentifier(t, state, 'createVNode'), [ const createVNode = t.callExpression(createIdentifier(t, state, 'createVNode'), [
tag, tag,
state.opts.compatibleProps ? t.callExpression(state.get('compatibleProps'), [props]) : props, compatibleProps ? t.callExpression(state.get('compatibleProps'), [props]) : props,
children[0] children[0]
? ( ? (
isComponent isComponent
@ -395,10 +397,6 @@ const transformJSXElement = (t, path, state) => {
), ),
]), ]),
), ),
t.objectProperty(
t.identifier('_'),
t.numericLiteral(1),
),
]) ])
: child : child
) : t.nullLiteral(), ) : t.nullLiteral(),