云音乐热评: https://www.tianapi.com/apiview/160
WYYun.vue
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 
 | <template><div>
 <ul>
 <li class="item" v-for="i in obj">
 <h4 >Title: {{i.source}}</h4>
 <p>Content:{{i.content}}</p>
 </li>
 </ul>
 
 </div>
 
 </template>
 
 <script>
 import axios from 'axios';
 import {reactive, toRefs} from "vue";
 export default {
 name: "WYYun",
 setup() {
 const state = reactive({obj:[
 ]});
 
 function addSome() {
 var that = this;
 axios.get("http://api.tianapi.com/hotreview/index?key=6f4a784ff0e20b3202ce0d8e15bd4e88&num=3")
 .then(function(resp){
 for(var i = 0; i < resp.data.newslist.length; i++ ){
 that.obj.push({
 "source" : resp.data.newslist[i].source,
 "content" : resp.data.newslist[i].content
 });
 }
 
 })
 }
 addSome();
 
 return {
 ...toRefs(state),addSome
 }
 }
 
 
 }
 </script>
 
 <style scoped>
 *{
 padding: 0;
 margin: 0;
 }
 
 .item{
 margin-left: 4%;
 margin-top: 4%;
 padding: 8px;
 width: 500px;
 height: auto;
 list-style: none;
 border: 1px solid #dd001b;
 box-shadow: 2px 2px 4px black;
 border-radius: 8px;
 }
 h4{
 color: #000;
 }
 p{
 color: #8b8b8b;
 }
 
 </style>
 
 | 
接口调用结果格式:
