본문 바로가기

카테고리 없음

vue js가 로드되기전 템플릿 태그가 잠시나올때 해결 방법

v-cloak

 

API — Vue.js

Vue.js - The Progressive JavaScript Framework

vuejs.org

  • Does not expect expression

  • Usage:

    This directive will remain on the element until the associated Vue instance finishes compilation. Combined with CSS rules such as [v-cloak] { display: none }, this directive can be used to hide un-compiled mustache bindings until the Vue instance is ready.

  • Example:

    [v-cloak] { display: none; }<div v-cloak> {{ message }} </div>

    The <div> will not be visible until the compilation is done.

위의 내용을 간단하게 요약하면

css 에 [v-cloak] { display: none; } 를 추가해 주고

mustache를 포함한 요소에 지시자를(v-cloak)을 써주면된다