[Vuejs]-How can I make data properties reactive in Vue?

0👍

For component ‘App’ set props :

new Vue({
    name: 'App',
    //set props msg for recieve from parent
    props: {
        msg: String
    },
    router,
    template: '<p>{msg}</p>'
  })

and pass msg from you component template:

<App :msg="msg" />

0👍

It worked :

<template>
  <div id="app">
    {{msg = 'AA'}}
    <img src="./assets/logo.png">
  </div>
</template>

new Vue({// eslint-disable-line no-new
  el: '#app',
  props: {
    msg: String
  },
  router,
  components: {App},
  template: '<App />',
  mounted () {
    axios.get('http://127.0.0.1:8000/api/stores').
    then(response =>(console.log(response.data.data)))
  }
})

Leave a comment