Peter Krauss
Peter Krauss

Reputation: 13930

Not see syntax error, was working at JSfiddle

It is a simplifyed fork from a tiny demo, https://v2.vuejs.org/v2/examples/commits.html and is running (!) at https://jsfiddle.net/gj1bryna/

The <li> block was simplified to

<li v-for="record in xx">
  <a :href="record.html_url" target="_blank" class="commit">{{ record.sha }}</a>
</li>

An at code renamed commits to xx and removed filters.

But when join all in one page... It is not working at this temporary page (was temporary, now editing to show difference)

When load the console show "ReferenceError: xx is not defined" eror.


EDIT

The difference was here:

  data: {
    branches: ['oficial.ls', 'oficial.ls_summary'],
    currentBranch: 'oficial.ls_summary',
    commits: null
  },

(I not renamed commits to xx here, sorry)

PS: it is a typical case where error message is not so abvious about real problem... And beacuse programmer is imagining a sequence (where initialization exists) and real execution is other sequence.

Upvotes: 0

Views: 31

Answers (1)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

So? xx is undefined. Why did you replaced commits?

If you really want to have different name, then rename the property from data option as well:

//So, you should have
data() {
  return {
    xx: [] // commits renamed or say xx is initialized
  }
}

Upvotes: 2

Related Questions