[Vuejs]-How do I add & use data that is within a Vue Template?

0👍

I would declare a new component as follows:

Vue.component('Home', {
template: `<div><div>{{ message }}</div></div>`,
data() {
    return { message: 'hello' }
}
});

0👍

Thanks to everyone for their help. Here is a working solution.

var Home = {
    template: `
    <div>
        <div>
            {{message}}
        </div>
    </div>
    `,
    data() {
        return { 
          message: 'hello'
        }
    }
};

Leave a comment