Skip to content

v-model value uses square bracket syntax with double quotes in <template lang="pug"> doesn't work since 3.2.13 version #5147

Description

@Lsnsh

Version

3.2.26

Reproduction link

github.com

Steps to reproduce

  • npm i
  • npm run serve
  • Visit http://localhost:8080/
  • Edit item2 in src/components/Case1.vue, then save the changes.
  • Uncomment input(v-model='row["item2"]') in src/components/Case1.vue, then save the changes.
  • Refresh http://localhost:8080/

Use vue@3.2.13 (has error)

  • Delete the node_modules folder.
  • Switch to 5147/use-vue-3.2.13-version branch.
  • Reinstall the dependencies and build.

Use vue@3.2.12 (ok)

  • Delete the node_modules folder.
  • Switch to 5147/use-vue-3.2.12-version branch.
  • Reinstall the dependencies and build.

What is expected?

Compiled Successfully.

What is actually happening?

VueCompilerError: v-model value must be a valid JavaScript member expression.
at /Users/lsnsh/study/other/vue-issue-examples/src/components/Case1.vue:1:189
1  |  <div><h3>[Pug template]: </h3><div :title="row['item1']">{{ row['item1'] }}</div><input v-model="row['item1']"><div :title="row[&quot;item2&quot;]">{{ row["item2"] }}</div><input v-model="row[&quot;item2&quot;]"></div>
   |                                                                                                                                                                                              ^^^^^^^^^^^^

//- The Error code in src/components/Case1.vue
input(v-model='row["item2"]')

Because i have some Chinese object property names.

At first I thought that the value of v-model does not support Chinese, but it is not

My project works fine on vue@3.2.11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions