javascript - 属性或方法“LIVE”未在实例上定义,但在渲染期间被引用
问题描述
我在 laravel 中使用 vue.js 来更新我的记分卡,一切正常,直到我不应用检查只更新实时比赛的记分卡。这是我的代码。
<script>
export default {
data: function(){
return {
scoreCard: "",
play: ""
};
},
props: ["live_check","playingteamid","series_id", "match_id"],
methods: {
getScoreCard: function(s, m, p) {
fetch(
"https://api_Request" +
s +
"/" +
m +
"?format=json"
)
.then(response => response.json())
.then(data => {
if(data.fullScorecard.innings[0].team.id==p){
this.play = data.fullScorecard.innings[0];
}else if(typeof data.fullScorecard.innings[1] !='undefined'){
if(data.fullScorecard.innings[1].team.id==p){
this.play = data.fullScorecard.innings[1];
}
}
});
}
},
created: function(){
this.getScoreCard(this.series_id,this.match_id,this.playingteamid);
if(this.live_check=='LIVE'){ //This Live check is showing error
setInterval(function(){
this.getScoreCard(this.series_id,this.match_id,this.playingteamid);
}.bind(this),3000)
}else{
console.log('Match is not Live');
}
}
};
</script>
vue.js:634 [Vue 警告]:属性或方法“LIVE”未在实例上定义,但在渲染期间被引用。通过初始化该属性,确保该属性是反应性的,无论是在数据选项中,还是对于基于类的组件。请参阅:https ://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties 。(在发现 )
解决方案
推荐阅读
- ruby-on-rails - Rails - 转储请求标头给出无法转储匿名模块
- python - Python正则表达式从字符串中获取所有图像src'
- rest - 如何使用jmeter发送多个json正文?
- python - 如何每 10 秒将数据写入文件
- php - 亚马逊通过使用 API PHP/jQuery 搜索 ASIN 获取商品详情
- javascript - 在 React Native 中的 FlatList 中延迟加载项目?
- java - Java中的版本比较
- regex - 基于缩进文本匹配的正则表达式前瞻
- git - Github - 合并被阻止 - 基础分支要求对所有提交进行签名
- ios - 推广的应用内购买未显示在应用商店中