반응형
마운트된 Vue 인스턴스의 속성을 업데이트하는 방법
수동으로 마운트된 Vue 인스턴스의 속성을 여러 DOM 요소(이 경우 맵박스 마커)에 바인딩합니다.
const makerContent = Vue.extend(Marker)
features.forEach(function(feature, index) {
var parent = document.createElement('div')
parent.classList.add("mapboxgl-marker")
var child = document.createElement('div')
child.classList.add("marker")
parent.appendChild(child)
const marker = new mapboxgl.Marker(parent)
.setLngLat(feature.geometry.coordinates)
.addTo(self.map)
new makerContent({
store: store,
propsData: {
feature: feature,
}
}).$mount(child);
})
스토어 변경(예:feature.geometry.coordinates
)는 새로고침 없이 Marker 컴포넌트에서 변경을 트리거하지 않습니다.
어떻게 바인드 할 수 있을까요?features
마커가 데이터 변경에 반응하는 경우?아마도 의 올바른 사용은 아닐 것이다.propsData
공유 Vuex 스토어 모듈?Vue가 현재 지원하지 않는 ES6 맵 상태의 변화를 추적해야 할 것 같습니다.
우리 엄마 좀 봐.GitHub의 vue 컴포넌트
언급URL : https://stackoverflow.com/questions/47000191/how-to-update-properties-of-mounted-vue-instance
반응형
'programing' 카테고리의 다른 글
java8 스트림에서의 처리 순서를 확인하는 방법 (0) | 2022.06.30 |
---|---|
"triggerScroll" 이벤트를 트리거하는 것은 무엇입니까? (0) | 2022.06.30 |
밸브라인드를 사용하여 메모리 누수를 찾는 방법 (0) | 2022.06.30 |
VueJ 핫 새로고침이 느리다 (0) | 2022.06.30 |
Vue js : Chrome에서 저장된 암호를 변경할 수 없습니다. (0) | 2022.06.30 |