[Vuejs]-Vue – using components in Vue instance

0👍

Change your data in the vue instance to:

data: {
        optionOne: { text: 'option one', icon: 'ico_opt1.svg', func: this.sendOptionOne },
        optionTwo: { text: 'option two', icon: 'ico_opt2.svg', func: this.sendOptionTwo }
},

Or another option is to:

data: function () {
        return {
            optionOne: { text: 'option one', icon: 'ico_opt1.svg', func: this.sendOptionOne },
            optionOne: { text: 'option two', icon: 'ico_opt2.svg', func: this.sendOptionTwo }
        }
    }(),

The last () would execute the function in place and assign the returned object to the data property.

Though I am not sure what is the plan with the :func thing, this should still resolve the issue.

Hope it helps.

Leave a comment