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

Syntax error on template + v-if + component + v-for #9155

Closed
Akryum opened this issue Dec 6, 2018 · 3 comments
Closed

Syntax error on template + v-if + component + v-for #9155

Akryum opened this issue Dec 6, 2018 · 3 comments

Comments

@Akryum
Copy link
Member

Akryum commented Dec 6, 2018

Version

2.5.18-beta.0

Reproduction link

https://github.com/Akryum/vue-2-5-18-beta-0-syntax-error

Steps to reproduce

Write a template that has a v-if, which contains a component with a v-for:

<template v-if="list.length">
  <Foo
    v-for="(letter, index) of list"
    :key="index"
  />
</template>

What is expected?

Compiles fine

What is actually happening?

 error  in ./src/components/TestError.vue?vue&type=template&id=56272718&

Syntax Error: SyntaxError: Unexpected token (1:157)


 @ ./src/components/TestError.vue?vue&type=template&id=56272718& 1:0-383 1:0-383
 @ ./src/components/TestError.vue
 @ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js&
 @ ./src/App.vue?vue&type=script&lang=js&
 @ ./src/App.vue
 @ ./src/main.js
 @ multi ./src/main.js


 ERROR  Build failed with errors.
@Akryum Akryum changed the title Syntax error on template v-if v-for component Syntax error on template + v-if + component + v-for Dec 6, 2018
@vickCZX
Copy link

vickCZX commented Dec 7, 2018

use v-show replace v-if, because v-if is false ,the document is inexistence, so v-for will error

@sqal
Copy link
Contributor

sqal commented Dec 7, 2018

Already fixed #9142

@posva posva closed this as completed Dec 7, 2018
@Akryum
Copy link
Member Author

Akryum commented Dec 7, 2018

Woops 😸

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

No branches or pull requests

4 participants