調用時出現此錯誤是沒有定義:length not defined這段代碼運行在玉時:長度玉
each time in appointment.location.openingTimes
p
| #{time.days}:
if time.closed
span.pull-right.badge-default closed
else
span.pull-right.badge-default #{time.opening} - #{time.closing}
它引用數組:
appointment: {
reason: 'Johnny to Busby3',
location: [{
name: 'Buga Buga Hospital',
phoneNumber: '(719) 589-1011',
address: {
street: '125 High Street',
region: 'Buga Buga, HI 85555',
},
distance: '100m',
coords: {
lat: 51.455041,
lng: -0.9690884
},
openingTimes: [{
days: 'Monday - Friday',
opening: '7:00 am',
closing: '7:00 pm',
closed: false
}, {
days: 'Saturday',
opening: '8:00 am',
closing: '5:00 pm',
closed: false
}, {
days: 'Sunday',
closed: true
}],
}],
我想有一些命名問題正在進行,但我找不到它們。
位置是一個數組,所以你不能用一個點訪問訪問openingTimes(位置是有openingTimes財產對象的數組),所以你需要兩個循環或重組數據 –