afoysal
21
1
Vue

Processing data inside watch()

Posted 9 months ago by afoysal

My HTML code is like below

<ul>
   <li v-for="item in values">{{ item }}</li>
</ul>

My vue.js code is like below

export default {
        data() {
            return {
                values: []
            }
        },
        props: ['applicants', 'pageinfo'],
        watch: {
            applicants (val) {
                EventBus.$on('click',  function (skillName) {
                    this.values = val[0];   
        console.log(this.values);  // I am getting output here.
                });
            },
        },
    }

I am trying to iterate over the values of val[0]. But I am not getting any output.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.