javascript - Vue not loading data -


i have vue/coffeescript app looks this:

there no errors in console, , says it's making successful external request json, when {{book.name}}, returns test instead of coming json.

new vue({ el: '#app', data: {   showmodal: false,   book: {     name: "test",     description: "",     photo: ""   } }  ready: () ->   this.getbookdata()   console.log (this.book)  methods: {   getbookdata: () ->     self = $(this)     $.getjson 'ggpk4a.json', (data) ->       self.book = data }  }) 

i don't know how in coffeescript, think issue this doesn't refer vue within callback function, setting this.book isn't working. can fix using .bind(this) on function, or setting var vm = this before ajax call , setting vm.book in callback.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -