i am learning coffee-script and vue.js and axio, i found an example from https://github.com/axios/axios as below
axios.get('/user', {
params: {
ID: 12345
}
})
.then(function (response) {
console.log(response);
}));
and in my vue file, i wrote this
<script lang="coffee">
import axios from 'axios'
export default
props: ['author']
data: ->
info: null
mounted: ->
vm = this
axios
.get 'https://api.coindesk.com/v1/bpi/currentprice.json'
.then (resp) ->
vm.info = resp
</script>
my question is how to translate javascript code
{
params: {
ID: 12345
}
}
to coffee script, to pass the argument directory without declare a new argument.
and the same as post example
axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
i do not know how to pass it directory in coffee script.
i have try these, all faild
.get 'https://api.coindesk.com/v1/bpi/currentprice.json' (param: {id: 1})
.get 'https://api.coindesk.com/v1/bpi/currentprice.json' {param: {id: 1}}
.get 'https://api.coindesk.com/v1/bpi/currentprice.json' param: {id: 1}
.get 'https://api.coindesk.com/v1/bpi/currentprice.json' {id: 1}
.get 'https://api.coindesk.com/v1/bpi/currentprice.json' id: 1
thank you.