【发布时间】:2020-01-08 21:11:55
【问题描述】:
我希望从我在methods中的哪个函数的api中获取美元,但我该怎么写呢?
data(){
return {
posts: 1,
USD:changeCurrency()
}
},
methods: {
changeCurrency: function () {
axios.get('http://data.fixer.io/api/latest?access_key=509c9d50c1e92a712be9c8f1f964cf67')
.then(response => {
this.posts = response.data.rates.GEL.toFixed(3)
})
}
【问题讨论】:
-
您如何使用您的费率?显示模板。