试图创建一个小应用程序来显示一些新闻,但无法弄清楚这个错误。我究竟做错了什么?我试图通过视觉“滑动”新闻来一次显示一个新闻。应用程序运行并工作,但仍显示此错误:[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 关注
- 92 浏览
添加回答
举报
0/150
提交
取消