0

I am new to Vue js i am practicing for loop in vue js When i try to fetch data from my app js file into my welcome blade file it displays the exact same variable that i wrote in code instead of showing value stored in the object.

Here is my code of app.js file

require('./bootstrap');
    
window.Vue = require('vue');
Vue.component('example', require('./components/Example.vue'));
    
const app = new Vue({
  el: '#app'
  data: {
    message: '',
    tasks: [
      { name: 'Foo' },
      { name: 'Bar' }
    ]
  }
});

and this is my welcome blade file code

links

<link href="/css/app.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="/js/app.js"> </script>

and the list i want to repeat

<div class="title m-b-md" id="app">
  <ul>
    <li v-for="task in tasks" >                     
      @{{ task.name }}                      
    </li>
  </ul>
  <example></example>
</div>
Hiws
  • 8,230
  • 1
  • 19
  • 36

1 Answers1

-1
 <div class="title m-b-md" id="app">
 <ul>
  <li v-for="(task,index) in tasks" :key="task.name">                     
   @{{ task.name }}                      
  </li>
 </ul>
 <example></example>
 </div>
  • 2
    Hi, welcome to SO. Thanks for taking some time out to answer this question, with small changes we can make it more clear for other users. Have a look at [tips for good answers](https://stackoverflow.com/help/how-to-answer) before you update the answer. – Hamid Ali Sep 14 '20 at 06:53