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

Error message for evaluting :class="class" degraded from 2 to 3 #1266

Closed
TheJaredWilcurt opened this issue May 30, 2020 · 1 comment
Closed

Comments

@TheJaredWilcurt
Copy link

TheJaredWilcurt commented May 30, 2020

Version

3.0.0-beta.14

Reproduction link

Steps to reproduce

What is expected?

Similar nice warning messages to teach users that class cannot be used directly in the template

Vue 2 warnings:

[Vue warn]: "class" is a reserved attribute and cannot be used as component prop.

found in

---> <SweetChild>
       <Root>
[Vue warn]: Error compiling template:

avoid using JavaScript keyword as property name: "class"
  Raw expression: :class="class"

1  |  <h1>asdf <span :class="class">asdf</span></h1>
   |                 ^^^^^^^^^^^^^^

found in

---> <SweetChild>
       <Root>

What is actually happening?

Gives cryptic error message

SyntaxError: missing { before class body
@TheJaredWilcurt
Copy link
Author

TheJaredWilcurt commented May 30, 2020

Perhaps a

[Vue warn]: "class" is a JavaScript keyword and cannot be evaluated directly.
Did you mean :class="$props.class" or :class="$attrs.class"?

Since those approaches both work in Vue 3.

@TheJaredWilcurt TheJaredWilcurt changed the title Class as prop error warning degraded from 2 to 3 Error message for evaluting :class="class" degraded from 2 to 3 May 30, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant