mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-01-10 16:29:12 +08:00
fix: <A {...{ a: 1 }} />
throw error when override props
This commit is contained in:
parent
e9aa278b20
commit
f50b9e37fd
@ -56,8 +56,10 @@ const transformJSXSpreadAttribute = (
|
||||
walksScope(nodePath, (argument.node as t.Identifier).name, SlotFlags.DYNAMIC);
|
||||
}
|
||||
args.push(mergeProps ? argument.node : t.spreadElement(argument.node));
|
||||
} else {
|
||||
} else if (mergeProps) {
|
||||
args.push(t.objectExpression(properties));
|
||||
} else {
|
||||
args.push(...(properties as t.ObjectProperty[]));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -84,6 +84,10 @@ exports[`override props multiple: multiple 1`] = `
|
||||
createVNode(resolveComponent(\\"A\\"), {
|
||||
\\"loading\\": true,
|
||||
...a,
|
||||
b: 1,
|
||||
c: {
|
||||
d: 2
|
||||
},
|
||||
\\"class\\": \\"x\\",
|
||||
\\"style\\": x
|
||||
}, null);"
|
||||
|
@ -149,10 +149,10 @@ tests.forEach((
|
||||
|
||||
const overridePropsTests = [{
|
||||
name: 'single',
|
||||
from: '<div {...a}></div>',
|
||||
from: '<div {...a} />',
|
||||
}, {
|
||||
name: 'multiple',
|
||||
from: '<A loading {...a} class="x" style={x}></A>',
|
||||
from: '<A loading {...a} {...{ b: 1, c: { d: 2 } }} class="x" style={x} />',
|
||||
}];
|
||||
|
||||
overridePropsTests.forEach((
|
||||
|
Loading…
Reference in New Issue
Block a user