|
1 | 1 | <template> |
2 | 2 | <div |
3 | 3 | class="vm2_wrapper vm2__animate-opacity" |
4 | | - id="vm2__cover_wrapper" |
| 4 | + :id="`vm2__cover_wrapper_${name}`" |
5 | 5 | v-show="visible" |
6 | 6 | :class="{ 'vm2__animate-show': blockVisible, 'vm2--dark': darkMode }" |
7 | 7 | :style="{ backgroundColor: wrapperBg }" |
8 | 8 | > |
9 | 9 | <div class="vm2_modal-dialog vm2_settings"> |
10 | 10 | <div |
11 | 11 | class="vm2_modal-content" |
12 | | - id="vm2_box" |
| 12 | + :id="`vm2_box_${name}`" |
13 | 13 | :style="{ backgroundColor: modalBgColor, color: fontColor }" |
14 | 14 | > |
15 | 15 | <withHeader v-if="!noHeader" @on-icon-click="handleClose" :props="{...headerOptions}"> |
@@ -147,24 +147,24 @@ export default { |
147 | 147 | mounted() { |
148 | 148 | // this.blockVisible = !this.visible; |
149 | 149 | const vm = this; |
150 | | - document.getElementById("vm2__cover_wrapper").onclick = function (e) { |
151 | | - if (!document.getElementById("vm2_box").contains(e.target)) { |
| 150 | + document.getElementById(`vm2__cover_wrapper_${vm.name}`).onclick = function (e) { |
| 151 | + if (!document.getElementById(`vm2_box_${vm.name}`).contains(e.target)) { |
152 | 152 | // alert("You clicked outside"); |
153 | | - if (document.getElementById("vm2__cover_wrapper").contains(e.target)) { |
| 153 | + if (document.getElementById(`vm2__cover_wrapper_${vm.name}`).contains(e.target)) { |
154 | 154 | // alert("Here"); |
155 | 155 | vm.handleClose(); |
156 | 156 | } |
157 | 157 | } |
158 | 158 | }; |
159 | | - document.onkeyup = function (e) { |
| 159 | + document.addEventListener('keyup', e => { |
160 | 160 | e = e || window.event; |
161 | 161 | if (e.keyCode == 27) { |
162 | | - // alert(`Esc key pr/zessed. ${vm.visible}`); |
| 162 | + // alert(`Esc key pr/zessed. ${vm.visible} ${vm.name}`); |
163 | 163 | if (vm.visible == true) { |
164 | 164 | vm.handleClose(); |
165 | 165 | } |
166 | | - } |
167 | | - }; |
| 166 | + } |
| 167 | + }) |
168 | 168 | }, |
169 | 169 | }; |
170 | 170 | </script> |
|
0 commit comments