Skip to content

Commit

Permalink
fix(compiler): Remove the waring for valid v-slot value
Browse files Browse the repository at this point in the history
  • Loading branch information
liximomo committed Apr 25, 2019
1 parent bd6cea0 commit 05051e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/compiler/error-detector.js
Expand Up @@ -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]
Expand Down
8 changes: 8 additions & 0 deletions test/unit/features/component/component-scoped-slot.spec.js
Expand Up @@ -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: `<foo ${syntax}="{ foo = { bar: '1' } }"></foo>`,
components: { Foo, Bar }
}).$mount();
expect('Invalid shorthand property initializer').not.toHaveBeenWarned()
})
}

// run tests for both full syntax and shorthand
Expand Down

0 comments on commit 05051e4

Please sign in to comment.