Skip to content

Commit 05051e4

Browse files
committed
fix(compiler): Remove the waring for valid v-slot value
1 parent bd6cea0 commit 05051e4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/compiler/error-detector.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function checkNode (node: ASTNode, warn: Function) {
3131
if (node.type === 1) {
3232
for (const name in node.attrsMap) {
3333
if (dirRE.test(name)) {
34+
if (name === 'v-slot') break;
3435
const value = node.attrsMap[name]
3536
if (value) {
3637
const range = node.rawAttrsMap[name]

test/unit/features/component/component-scoped-slot.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,14 @@ describe('Component scoped slot', () => {
759759
}).$mount()
760760
expect(`Unexpected mixed usage of different slot syntaxes`).toHaveBeenWarned()
761761
})
762+
763+
it('should allow destructuring props with default value', () => {
764+
new Vue({
765+
template: `<foo ${syntax}="{ foo = { bar: '1' } }"></foo>`,
766+
components: { Foo, Bar }
767+
}).$mount();
768+
expect('Invalid shorthand property initializer').not.toHaveBeenWarned()
769+
})
762770
}
763771

764772
// run tests for both full syntax and shorthand

0 commit comments

Comments
 (0)