我收到此错误:× TypeError:无法读取未定义的属性“open_now”
render(){
9 | let ob = this.props.data.opening_hours;
> 10 | if(ob.open_now !== undefined){
11 | console.log(ob.open_now);
12 | }
13 | else{
当我打印出开放时间属性
时,这就是我得到的opening_hours: {
open_now: true,
periods: [],
weekday_text: [
"Monday: 10:00 AM – 9:00 PM",
"Tuesday: 10:00 AM – 9:00 PM",
"Wednesday: 10:00 AM – 9:00 PM",
"Thursday: 10:00 AM – 9:00 PM",
"Friday: 10:00 AM – 9:00 PM",
"Saturday: 10:00 AM – 9:00 PM",
"Sunday: 10:00 AM – 8:00 PM"
]
},
但是一旦我尝试获取open_now或weekday_texts,它就会给我同样的错误。我可以访问JSON对象内的任何内容,除了那个。谷歌的地方API不再工作了吗?我能够得到网站,电话号码和姓名,我不知道为什么它只在开放时间崩溃