As in the vue output by clicking?

In the process of learning the basics of vue trying to rewrite the jquery script.
There is such an example.
1) Here I tried to make a two-level menu, and now I want when clicking on it the points have been updated the values in the rows a, b , and a link to the photo.
As I understand it, the correct solution is to create the object data a new variable (active in my case), and it seems to keep the value of the active menu item. For this I created a method changeCategory, but what to assign in active don't know. And I suspect that my account {{active.a}} until the first click will generate an error.
2) How to make when loading the site the first item of the first menu is already selected? On jquery I could do something like $(ul ul li).eq(0).click().
April 7th 20 at 15:19
1 answer
April 7th 20 at 15:21
Solution
<div @click="changeCategory(subcat)">
...
<div v-for="(v, k) is in active">{{ k }}: {{ v }}</div>

changeCategory({ a, b }) {
 this.active = { a, b };
},

How to make when loading the site the first item of the first menu is already selected?

created() {
this.changeCategory(this.categories[0].sub[0]);
},

Find more questions by tags Vue.js