diff --git a/src/compiler/error-detector.js b/src/compiler/error-detector.js index 22c3b75d3aa..3d1403a9448 100644 --- a/src/compiler/error-detector.js +++ b/src/compiler/error-detector.js @@ -31,6 +31,7 @@ function checkNode (node: ASTNode, warn: Function) { if (node.type === 1) { for (const name in node.attrsMap) { if (dirRE.test(name)) { + if (name === 'v-slot') break; const value = node.attrsMap[name] if (value) { const range = node.rawAttrsMap[name] diff --git a/test/unit/features/component/component-scoped-slot.spec.js b/test/unit/features/component/component-scoped-slot.spec.js index f8a0f11b7fa..d0fcc3e8252 100644 --- a/test/unit/features/component/component-scoped-slot.spec.js +++ b/test/unit/features/component/component-scoped-slot.spec.js @@ -759,6 +759,14 @@ describe('Component scoped slot', () => { }).$mount() expect(`Unexpected mixed usage of different slot syntaxes`).toHaveBeenWarned() }) + + it('should allow destructuring props with default value', () => { + new Vue({ + template: ``, + components: { Foo, Bar } + }).$mount(); + expect('Invalid shorthand property initializer').not.toHaveBeenWarned() + }) } // run tests for both full syntax and shorthand