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

feat(warn): Warn on colon shorthand usage on directive (fix #10191) #10199

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Make error message more explicit
  • Loading branch information
afontcu committed Jun 26, 2019
commit ee1c09315ac9b8647a9f31fa962deb5b4442e0d3
2 changes: 1 addition & 1 deletion src/compiler/parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ function processAttrs (el) {
// :v-if or similar
if (process.env.NODE_ENV !== 'production' && colonDirRE.test(name)) {
warn(
`A v-bind shorthand directive was used on another Vue directive. Did you want to write '${name.substr(1)}="${value}"'?`
`A v-bind shorthand was used on another Vue directive. Did you mean '${name.substr(1)}="${value}"' instead of '${name}'?`
)
}
if (dirRE.test(name)) {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/modules/compiler/parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ describe('parser', () => {

it('warns when using v-bind shorthand on a directive', () => {
parse('<div :v-if="foo"></div>', baseOptions)
expect(`A v-bind shorthand directive was used on another Vue directive. Did you want to write 'v-if="foo"'?`).toHaveBeenWarned()
expect(`A v-bind shorthand was used on another Vue directive. Did you mean 'v-if="foo"' instead of ':v-if'?`).toHaveBeenWarned()
})

it('empty v-bind expression', () => {
Expand Down