UserStory
쉽게 모달을 열고 닫을 수 있다.
ex) 구글 메인페이지 google apps 목록 펼쳐보기
모달 외부 클릭하여 닫기 위한 필수조건
</body>
<div>
<button>Modal open</button>
<div class="modal" tabindex="-1" ref="mymodal"
v-if="isModalOpen"
@blur="closeModal">
<button @click="openModal">Modal close</button>
this is my modal
</div>
</div>
</body>
<script>
data : {
return(){
isModalOpen : false,
}
},
methods : {
openModal : function(){
this.isModalOpen = true;
let self = this;
this.$nextTick(function(){
self.$refs.mymodal.focus();
})
},
closeModal : function(){
this.isModalOpen = false;
}
}
</script>