Vue: v-for syntax suggesition

Created on 18 Nov 2016  路  3Comments  路  Source: vuejs/vue

  it('v-for', function (done) {
    new Vue({
      el: el,
      template: '<test v-for="n in list" :n="n"></test>',
      data: {
        list: [1, 2, 3]
      },
      components: {
        test: function (resolve) {
          setTimeout(function () {
            resolve({
              props: ['n'],
              template: '{{n}}'
            })
            next()
          }, 0)
        }
      }
    })
    function next () {
      expect(el.textContent).toBe('123')
      done()
    }
  })

I think it should be OK if we have
template: '<test v-for="n in list" n="n"></test>',
omit the ":"

Most helpful comment

Please make sure to read the Issue Reporting Guidelines before opening new issues. The issue list only accepts bug reports and feature requests. Questions should be posted to the Gitter chat room, forum or StackOverflow. Thanks.

All 3 comments

:n is a shorthand of v-bind:n.

sorry I mean
template: '<test v-for="n in list" n="n"></test>' should be Okay
@yyx990803 this is kind of like a feature request XD
@fnlctrl

Please make sure to read the Issue Reporting Guidelines before opening new issues. The issue list only accepts bug reports and feature requests. Questions should be posted to the Gitter chat room, forum or StackOverflow. Thanks.

Was this page helpful?
0 / 5 - 0 ratings