binding to array not working within vue instance
<p>I'm trying to get my head around vue.js but I seem to be missing something essential.</p>

<p>I have several boxes and I want them to act like an accordion (only one gets displayed; opening another box closes the previous one). This is my code:</p>

<pre><code>&lt;div id="app"&gt;

  &lt;div class="block"&gt;
    &lt;button v-on:click="mytoggle(0,$event)"&gt;block one&lt;/button&gt;
    &lt;div v-if="boxes[0]"&gt;
      &lt;p&gt;i am box number one&lt;/p&gt;
      &lt;p&gt;i am box number one&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div class="block"&gt;
    &lt;button v-on:click="mytoggle(1,$event)"&gt;block two&lt;/button&gt;
    &lt;div v-if="boxes[1]"&gt;
      &lt;p&gt;i am box number two&lt;/p&gt;
      &lt;p&gt;i am box number two&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div class="block"&gt;
    &lt;button v-on:click="mytoggle(2,$event)"&gt;block three&lt;/button&gt;
    &lt;div v-if="boxes[2]"&gt;
      &lt;p&gt;i am box number three&lt;/p&gt;
      &lt;p&gt;i am box number three&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;pre&gt;{{ $data | json }}&lt;/pre&gt;

&lt;/div&gt;
</code></pre>

<p>and the script:</p>

<pre><code>var vm = new Vue({
    el: '#app',

    methods: {
        mytoggle: function (n, event) {
            event.preventDefault();
            for(var i = 0; i &lt; 3; i++) { // close all boxes
                this.boxes[i] = false;
            }
            this.boxes[n] = true; // open the corresponding box
            console.log(n);
        }
    },

    data: {
        boxes: [false,true,false]
    }
});
</code></pre>

<p>When the page is loaded, the second box gets displayed (which is correct, because the second element in the boxes array is true).</p>

<p>But clicking on the buttons doesn't change the boxes.array nor the display of the boxes. The log tells me, that the script as such seems to work because I get the correct value logged when I click the buttons.
So I suppose its something in the binding.
Can someone lead me on the right track?</p>