第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

vue 用axios獲取的數(shù)據(jù)怎么不能渲染到頁面?

vue 用axios獲取的數(shù)據(jù)怎么不能渲染到頁面?

毛Bing 2018-12-07 17:59:49
<!DOCTYPE html><html><head>? ? <meta charset="UTF-8">? ? <title>Document</title>? ? <link rel="stylesheet" href="../style/compStyle/index.css"></head><body>? ? <div id="app">? ? ? ? <div class="header">? ? ? ? ? ? <h1>{{message}}</h1>? ? ? ? </div>? ? ? ? <ul>? ? ? ? ? ? <li v-for="item in todos" :key="item">{{item.name}}</li>? ? ? ? </ul>? ? ? ? <li @click="getAxios">? ? ? ? ? ? Axios? ? ? ? </li>? ? </div>? ? <script src="../node_modules/vue/dist/vue.min.js"></script>? ? <script src="../node_modules/axios/dist/axios.min.js"></script>? ? <script>? ? ? ? var app = new Vue({? ? ? ? ? ? el: '#app',? ? ? ? ? ? data: {? ? ? ? ? ? ? ? message: '四川政協(xié)網(wǎng)',? ? ? ? ? ? ? ? todos:[]? ? ? ? ? ? },? ? ? ? ? ? methods:{? ? ? ? ? ? ? ? getAxios(){? ? ? ? ? ? ? ? ? ? if(axios){? ? ? ? ? ? ? ? ? ? ? ? console.log('Axios')? ? ? ? ? ? ? ? ? ? ? ? axios.get('./app.json')? ? ? ? ? ? ? ? ? ? ? ? .then(this.getDate)? ? ? ? ? ? ? ? ? ? ? ? .catch(function (error) {? ? ? ? ? ? ? ? ? ? ? ? ? ? console.log(error)? ? ? ? ? ? ? ? ? ? ? ? })? ? ? ? ? ? ? ? ? ? }else{? ? ? ? ? ? ? ? ? ? ? ? console.log('無')? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? },? ? ? ? ? ? ? ? getDate(res){? ? ? ? ? ? ? ? ? ? console.log(res)? ? ? ? ? ? ? ? ? ? res = res.data? ? ? ? ? ? ? ? ? ? if (res.ret && res.data) {? ? ? ? ? ? ? ? ? ? ? ? const data = res.data? ? ? ? ? ? ? ? ? ? ? ? this.todos = data.todos? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? ? ? //console.log(res)? ? ? ? ? ? ? ? }? ? ? ? ? ? },? ? ? ? ? ? mounted(){? ? ? ? ? ? ? ? this.getAxios()? ? ? ? ? ? }? ? ? ? })? ? </script></body></html>
查看完整描述

2 回答

?
聰明的湯姆

TA貢獻(xiàn)112條經(jīng)驗(yàn) 獲得超33個贊

語法明顯錯了吧

axios.get().then(res => { this.getDate(res) })

查看完整回答
反對 回復(fù) 2018-12-07
  • 2 回答
  • 0 關(guān)注
  • 5564 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號