Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template compile error when defining a default slot without a single root element. #828

Closed
andre-tebart opened this issue Jul 17, 2018 · 2 comments
Labels

Comments

@andre-tebart
Copy link

Version

1.0.0-beta.20

Reproduction link

https://codesandbox.io/s/wox3y9zljl

Steps to reproduce

  1. Look at the src/TestComponent.spec.js
  2. Look at the Vue warn message in the Console tab
[Vue warn]: Error compiling template:


<div>Hello</div><div>World</div>


- Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
  1. Look at the test tab and see that the 'mount with default slot' test fails.

What is expected?

That the test passes. The defined default slot contains a template string with two div elements next to each other and no single root element. In regular Vue templates there is no problem defining a default slot without a single root element when the slot content gets embedded inside another element.

What is actually happening?

The test fails and produces the mentioned template compile error.

@eddyerburgh
Copy link
Member

Has your code sandbox reproduction changed? It doesn't display that error message any more, and the test passes as expected.

@andre-tebart
Copy link
Author

You are right. I accidentally changed it. I restored the originial reproduction code which shows the error message: https://codesandbox.io/s/wox3y9zljl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants