이 컴포넌트 내장 API들은 컴포넌트 내부의 특정 기능 수행, 상태 접근에 사용된다.
$
속성과 메서드$data
:
this.$data
로 컴포넌트 내의 모든 데이터를 확인할 수 있습니다.$props
:
props
를 나타내는 객체입니다.this.$props
로 모든 props
에 접근할 수 있습니다.$emit
:
this.$emit('eventName', payload)
를 호출하면 부모 컴포넌트에서 해당 이벤트를 청취할 수 있습니다.$refs
:
ref
로 정의된 DOM 요소나 자식 컴포넌트 인스턴스에 접근할 때 사용합니다.this.$refs.myInput
으로 특정 DOM 요소를 직접 참조할 수 있습니다.$el
:
this.$el
은 컴포넌트의 최상위 HTML 요소를 가리킵니다.$watch
:
props
가 변경될 때 실행할 콜백 함수를 등록할 때 사용합니다.this.$watch('count', (newValue, oldValue) => { ... })
$nextTick
:
this.$nextTick(() => { ... })
으로 실행됩니다.$router
:
this.$router.push('/new-route')
으로 라우팅을 변경할 수 있습니다.$store
:
this.$store.state.property
로 상태에 접근하거나 this.$store.commit('mutationName')
으로 변이를 호출할 수 있습니다.