[HTML] 纯文本查看 复制代码 <!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>demo</title>
</head>
<body>
<div id="app">
<div v-for="item in list" :key="item" class="content">{{item}}</div>
</div>
</body>
<script src="https://unpkg.com/vue@next"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
const API = "http://rqh35x.natappfree.cc/cyy/calendarInfo/getList"
const param = { "dateStr": 2022 }
const app = {
data() {
return {
list: []
}
},
methods: {
// 使用axios获取接口参数
getCalendarInfoList() {
axios.post(API, param).then(res => {
console.log(res);
this.list = res.data.data
}).catch(err => {
console.log(err);
})
}
},
created() {
this.getCalendarInfoList()
}
}
Vue.createApp(app).mount('#app')
</script>
</html>
根据你的接口,简单弄了一个demo,获取数据正常 |