1

I'm trying to use vue with vue-resource without success. what am I doing wrong? Follow the code

I'm using CDN

I'm starting with the vuejs and I appreciate the help.

<div id="beerApp">
<ul>
 <li v-for="cervejaria in cervejarias">{{cervejaria.name}}</li>
</ul>
</div>



<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/vue.resource/1.0.3/vue-resource.min.js"></script>

<script>

// vue js codes will be here
new Vue({
  el:'#beerApp',

data:{
    cervejarias: []
 },

ready:function ()
{
  this.$http.get('https://gist.githubusercontent.com/vedovelli/3a83755e576778088c93/raw/204ced0602760829597f5caa2680e5f7cb29bade/cervejarias.json').then((response) => {
    this.$set('cervejarias',response.json()) 
  }, (error) => {
     consoel.log(error)
  });

}

});

1 Answer 1

1

It's because there are no longer ready() lifecycle hook into Vue 2.

Instead you can go with mounted() or created() lifecycle hooks.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.