【发布时间】:2019-01-03 05:30:56
【问题描述】:
在我的 vue 模板中,我有这个...
<template>
<div id="container">
{{show_municipality_in_words(12)}}
</div>
</template>
在我的 js 中...
export default {
data() {
},
methods: {
show_municipality_in_words(municipality_id) {
fetch(`api/biodidb/get_municipality_name_by_id/${municipality_id}`)
.then(response => response.json())
.then(result => {
console.log(result.Municipality);
return result.Municipality;
}).catch(err => {console.log(err)});
}
}
}
在 html 视图中,它什么都不返回,但在控制台中它有数据.. 这是显示它的正确方式吗?
【问题讨论】: