0
  <v-app>
    <h1>This is students Page</h1>
    <p>{{question}}</p>
  </v-app>
</template>

<script>
import ChannelDetails from './ChannelDetails'

export default {
  name: 'Student',
  data: () => ({
    question: ''
  }),
  created() {
    var channel = ChannelDetails.subscribeToPusher();
    channel.bind("data-add-event", function(data) {
      console.log(data)
      this.question = data.question;
      console.log(this.question)
    })
  }, 
}
</script>

I am getting the question in my console but am unable to get it in the dom. can you please suggest to me a way out? thanks....

1 Answers1

1

How to access the correct `this` inside a callback

Your "this" inside a callback might not be the correct "this", try using an arrow function, or refer to the link above for more help

Bin Phan
  • 11
  • 1