0

I am using NuxtJs and created test.vue in pages directory. Here is my code in test.vue.

<template>
  <div> 
    <h1 style="font-size: 30px">{{ message }} </h1>
    <h1 style="font-size: 30px"> Messsage here </h1>
  </div>
</template>

<script>

export default {
  data: {
    message: 'sdfsd'
  }
}
</script>

But {{ message }} not displaying. What is the problem?

1

1 Answer 1

1

The data needs to be a function so that each instance can maintain an independent copy of the returned data object.

export default {
  data() {
    return {
       message: 'sdfsd'
    }
  }
}

Read more here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.