Skip to content

Error compiling template if using unicode naming as v-for alias #6971

Closed
@nobodxbodon

Description

Version

2.5.2

Reproduction link

http://jsfiddle.net/bubq0ppd/

Steps to reproduce

Running the jsfiddle instance should make the warning appear in the console.

Just in case, here's the html and js code:

<script src="https://unpkg.com/vue"></script>
    <div id="元素id4">
      <ol>
        <li v-for="任务 in 任务表">
          {{ 任务.内容 }}
        </li>
      </ol>
    </div>
var 应用4 = new Vue({
  el: '#元素id4',
  data: {
    任务表: [
      { 内容: '学习 JavaScript' },
      { 内容: '学习 Vue' },
      { 内容: '整个牛项目' }
    ]
  }
})

What is expected?

IMHO, as the elements still displays in spite of the warning, this warning should not appear.

What is actually happening?

It seems to be caused by the regex for identifier validation here:
https://github.com/vuejs/vue/blob/dev/packages/vue-template-compiler/build.js#L3870

But I'm not sure why it only happens to alias instead of the iterator ("todo in 任务表" doesn't complain)


This issue is just noticed when I'm try to use Chinese naming as much as possible in sample codes in official guide: https://github.com/program-in-chinese/vuejs_guide_zh

Thanks for your time.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions