試圖創建一個小應用程序來顯示一些新聞,但無法弄清楚這個錯誤。我究竟做錯了什么?我試圖通過視覺“滑動”新聞來一次顯示一個新聞。應用程序運行并工作,但仍顯示此錯誤:[Vue warn]: Error in created hook: "TypeError: handler.call is not a function"模板:<template> <div> <div class="a_news" v-for="aNews in news"> <span v-show="true"> <h1 class="title" v-text="aNews.title"></h1> <div class="text" v-text="aNews.text"></div> <div class="aNews_image"><img v-bind:src="aNews.images[0]"/></div> </span> </div> </div></template>腳本:export default { data() { return { news: [], } }, computed: { }, created: { }, mounted() { this.getData(false, 0); }, methods: { getData(oldnum, num) { const CORS_PROXY = "https://cors-anywhere.herokuapp.com/"; axios.get(CORS_PROXY + 'URL').then(resp => { console.log(resp.data); this.news.push(resp.data.slides[num]); }); setTimeout(function () { if(oldnum == false) { oldnum = num; } if(oldnum >= 0) { oldnum = num; num = num +1 } this.news = []; if(num >= 8) { this.getData(false,0) }else{ this.getData(oldnum,num) } }.bind(this), 25000) } } }
- 2 回答
- 0 關注
- 127 瀏覽
添加回答
舉報
0/150
提交
取消