티스토리 뷰
참고링크 | https://kr.vuejs.org/v2/examples/modal.html |
1. Modal.vue파일 생성
(components/common폴더 생성 후 Modal.vue파일 생성함)
- template 내용 / style 내용 붙여 넣기
<template> <transition name="modal"> <div class="modal-mask"> <div class="modal-wrapper"> <div class="modal-container"> <div class="modal-header"> <slot name="header"> 모달 상단 </slot> </div> <div class="modal-body"> <slot name="body"> 모달 내용 </slot> </div> <div class="modal-footer"> <slot name="footer"> 모달 하단 <button class="modal-default-button" @click="$emit('close')"> 닫기 </button> </slot> </div> </div> </div> </div> </transition> </template> <script> export default { } </script> <style> .modal-mask { position: fixed; z-index: 9998; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, .5); display: table; transition: opacity .3s ease; } .modal-wrapper { display: table-cell; vertical-align: middle; color:#555555; } .modal-container { width: 300px; margin: 0px auto; padding: 20px 30px; background-color: #fff; border-radius: 2px; box-shadow: 0 2px 8px rgba(0, 0, 0, .33); transition: all .3s ease; font-family: Helvetica, Arial, sans-serif; } .modal-header h3 { margin-top: 0; color: #42b983; } .modal-body { margin: 20px 0; } .modal-default-button { float: right; } /* * The following styles are auto-applied to elements with * transition="modal" when their visibility is toggled * by Vue.js. * * You can easily play with the modal transition by editing * these styles. */ .modal-enter { opacity: 0; } .modal-leave-active { opacity: 0; } .modal-enter .modal-container, .modal-leave-active .modal-container { -webkit-transform: scale(1.1); transform: scale(1.1); } </style> |
2. 모달을 불러올 페이지에 모달 소스 넣기
template | <button id="show-modal" @click="showModal = true">Show Modal</button> <!-- use the modal component, pass in the prop --> <Modal v-if="showModal" @close="showModal = false"> <!-- you can use custom content here to overwrite default content --> <h3 slot="header">모달 창 제목</h3> </Modal> |
script | <script> import Modal from '../components/common/Modal.vue' export default { data() { return{ showModal: false } }, components : { Modal } } </script> |
vue3버전 --- v-slot : header 로 작업
'WEB > vue.js' 카테고리의 다른 글
[vue.js] fortawesome 사용하기 (0) | 2021.12.21 |
---|---|
ESLint 에러 화면에 표시되지 않게 작업하기 (0) | 2021.11.29 |
vue.js 구구단 (0) | 2021.11.04 |
vue 기본문법 (0) | 2021.11.04 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 지마켓산스(Gmarket Sans)체 #지마켓산스 #Gmarketfont #GmarketSans #무료폰트 #타이틀폰트 #디자인폰트 #웹폰트
- JPA #
- SQL #INSERTINTO #DELETE #UPDATE
- SQL #TABLE생성 #SQL제약조건
- DB #DBCREATE #DBDROP #DBBAKUP
- 무료폰트 #무료웹폰트 #평창평화체 #평화체 #이벤트용서체 #이벤트서체 #디자인폰트
- JDBC #DBMS
- 이벤트폰트 #이벤트용폰트 #디자인폰트 #디자인서체 #웹폰트
- JPA #JPA설정
- S-Core
- SQL명령어 #SQL
- thymeleaf
- 프리텐다드폰트 #고딕폰트 #무료폰트 #타이틀용폰트 #고딕 #웹폰트 #디자인폰트
- 세방고딕체 #웹폰트 #무료폰트 #무료웹폰트 #디자인폰트 #이벤트폰트 #디자인폰트 #타이틀용폰트
- S-CoreDream
- JPA #JPARepository
- jQuery #jQuery이미지슬라이드 #이미지슬라이드
- Thymeleaf #타임리프
- JPA #JPAEntity
- DTO #Entity
- 카페24폰트 #무료폰트 #무료웹폰트
- JPA Repository query keywords
- SELETE
- SELECTANY #SELECTALL
- JPA #JPAEntity #JPA연관관계
- ORM종류
- JPA Auditing #JPA
- 나눔폰트 #네이버글꼴 #네이버폰트 #고딕폰트 #본문폰트 #제목폰트 #무료폰트 #디자인폰트 #웹폰트
- SQL #SQLJOIN #JOIN #INNERJOIN #OUTERHJOIN
- Hibernate #ORM
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함