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

unable to use new-line in v-for attribute #7792

Comments

@FranckFreiburger
Copy link

Version

2.5.15

Reproduction link

https://jsfiddle.net/50wL7mdz/177321/

Steps to reproduce

run and look at the error in the console

What is expected?

new-line (\n) support in v-for

What is actually happening?

vue.js [Vue warn]: Error compiling template:

<div id="app">
  <p v-for="
    i in (2
     2)
  ">{{ message }}</p>
</div>

- invalid expression: Unexpected token } in

    (2

  Raw expression: v-for="
    i in (2
     2)
  "


My real case is much more complex and would need new-line for readability, especially since /* */ comment are accepted.

 <p v-for="
    i in (2 /* foo */
     2)     /* bar */
  ">{{ message }}</p>
@Gudradain
Copy link

Why not created a computed property that does foo + bar instead?

I usually wouldn't recommend putting complex computation directly into the template.

This was referenced Mar 14, 2018
f2009 pushed a commit to f2009/vue that referenced this issue Jan 25, 2019
aJean pushed a commit to aJean/vue that referenced this issue Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment