2
지도 용 영역이있는 객체가 있습니다. 다른 모든 영역에도 홈페이지 영역을 사용하기 때문에 홈페이지 영역을 다른 모든 영역으로 참조하기 위해 무언가를 사용하여 코드를보다 읽기 쉽고 짧게 만듭니다. 편집을 위해 객체 배열 홈페이지를 어떻게 사용할 수 있습니까? 코드가 짧아집니다. 이 같은 것을 _images.edit.areas = _images.homepage.areas? 아니면 별도의 개체에 홈페이지를 정의해야합니까?개체 배열 값을 개체 내의 다른 배열 값으로 가져 오는 방법은 무엇입니까?
var _images = {
homepage: {
path: 'homepage.jpg',
areas: [{
coords: '45,143,106,158',
text: 'edit',
goto: 'edit'
}, {
coords: '45,164,149,180',
text: 'config',
goto: 'config'
}, {
coords: '45,181,108,196',
text: 'setfree',
goto: 'setfree'
}]
},
edit:{
path: 'edit.jpg',
areas: [{
coords: '18,131,113,140',
text: 'homepage',
goto: 'homepage'
}, {
coords: '45,164,149,180',
text: 'config',
goto: 'config'
}, {
coords: '45,181,108,196',
text: 'setfree',
goto: 'setfree'
},{ //above everything is like in hompage, below are news areas
coords: '638,467,652,478',
text: 'contract',
goto: 'contract'
}]
},
}
감사합니다. 음, 그럼 나눠 줄거야. ^^ – Emloy