0👍
Use this
as you do normally with the data:
axios.get('/messages/' + this.surgery_id).then(...)
You can access all the property of data option,props, and methods using this
as context.
Further, if you want to use ES6, then it’s even easier without concatenating them: (using tilde key `)
axios.get(`/messages/${this.surgery_id}`).then(...)
As per your query, you also need to pass props in your instance:
const app = new Vue({
// ...
propsData:{
surgery_id: 'your id value'
}
See my another post for more help.
- [Vuejs]-Vue – how to use an event handler to invoke functions from sibling/child
- [Vuejs]-Working with Vuex with Vue and displaying data
Source:stackexchange.com