Code Review Stack Exchange is a question and answer site for peer programmer code reviews. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm displaying a conflict marker for each actor for each day, if the current day is in their conflicts.

<li v-for="date in next_three_months">
  <template v-for="actor in cast">
    <template v-for="conflict in actor.conflicts">
      <i v-if="date.datestamp==conflict.datestamp" class="is-conflict"></i>
    </template>
  </template>
</li>

This works... it just feels like a lot of code (despite it already being a dozen or so lines shorter than how I was doing it before using Vue JS).

Here's my Vue.js:

new Vue({
  el: '#schedule-builder',

  data: {

    cast: [
      {{ cast_list }}
          {
            actor: {
              id: "{{ actor_id }}",
              name: "{{ actor_name or 'TBD' }}",
            },
            conflicts: [
              {{ conflict_calendar }}
                { datestamp: "{{ value }}" },
              {{ /conflict_calendar }}
            ],
          },
      {{ /cast_list }}
    ],

    next_three_months: [
      {
        datestamp: '{{ now | format:Y-m-d }}',
      },
      {{ loop times="90" }}
        {
          datestamp: '{{ now | modify_date:+1 day | format:Y-m-d }}',
        },
      {{ /loop }}
    ],
share|improve this question
1  
Your Vue.js file does not appear to be written in JavaScript. What language or dialect is it written in? – Aluan Haddad Oct 2 at 16:37
    
It's Vue. Vue JS? See vuejs.org – danfo Oct 2 at 23:58
    
It's a framework not a language and in the documentation the viewmodel is written in JavaScript. Your Vue.js is not JavaScript. – Aluan Haddad Oct 3 at 7:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.