Skip to content

[vue-template-compiler] Multiline v-model expressions break compilation #9183

@andrew-humu

Description

@andrew-humu

Version

2.5.19

Reproduction link

https://codesandbox.io/s/88633ym7y0

Steps to reproduce

See below.

What is expected?

<my-input
  propa="a"
  propb="b"
  v-model="
    some.very.long[dynamic]expression
  "
>

This should compile, and behave identically to the single-line version:

<my-input
  propa="a"
  propb="b"
  v-model="some.very.long[dynamic]expression"
>

What is actually happening?

Compilation fails, with an error that looks like this:

SyntaxError: Unterminated string constant (3:142)
    at Parser.pp$4.raise (/node_modules/vue-template-es2015-compiler/buble.js:2610:13)
    at Parser.pp$8.readString (/node_modules/vue-template-es2015-compiler/buble.js:3436:35)
    at Parser.pp$8.getTokenFromCode (/node_modules/vue-template-es2015-compiler/buble.js:3220:17)

Note that this only applies when setting v-model on a custom component (not a string-element, e.g. <input>).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions