programing

vue에서 정확히 언제 다시 발생합니까?

prostudy 2022. 6. 18. 09:23
반응형

vue에서 정확히 언제 다시 발생합니까?

데이터가 변경되면 Vue가 재렌더하는 것으로 알고 있습니다.하지만 후크 기능으로 데이터를 변경할 때처럼mounted, 페이지는 재인스톨 되지 않습니다.다음은 제 코드의 일부입니다.

 mounted: function () {
  document.getElementById('lanchange').onclick = function (e) {
    this.loginPopActive = false
    this.lanPopActive = false
    console.log(this.lanPopActive)
  }
}

코드에 문제가 있다this화살표 기능, 클로저 또는bind.

mounted: function () {
  document.getElementById('lanchange').onclick = (e) = >{
    this.loginPopActive = false
    this.lanPopActive = false
    console.log(this.lanPopActive)
  }
}

언급URL : https://stackoverflow.com/questions/45031230/when-does-re-render-happen-exactly-in-vue

반응형