|
| 1 | +<template> |
| 2 | + <div class="pb-8"> |
| 3 | + <vue-final-modal |
| 4 | + v-model="showModal" |
| 5 | + classes="flex justify-center items-center" |
| 6 | + content-class="relative max-h-1/2 p-4 bg-white dark:bg-gray-900 border dark:border-gray-800 rounded-lg overflow-auto" |
| 7 | + v-bind="props" |
| 8 | + > |
| 9 | + <span class="text-2xl mb-2"># Hello, world!</span> |
| 10 | + <p> |
| 11 | + Lorem Ipsum is simply dummy text of the printing and typesetting |
| 12 | + industry. |
| 13 | + </p> |
| 14 | + <button |
| 15 | + class="absolute top-0 right-0 mt-2 mr-4 text-3xl hover:text-gray-700 leading-none focus:outline-none" |
| 16 | + @click="showModal = false" |
| 17 | + > |
| 18 | + x |
| 19 | + </button> |
| 20 | + </vue-final-modal> |
| 21 | + |
| 22 | + <base-button @click="showModal = true">Open Basic Modal</base-button> |
| 23 | + |
| 24 | + <h4>Prop Options:</h4> |
| 25 | + |
| 26 | + <div |
| 27 | + class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 p-4 border rounded" |
| 28 | + > |
| 29 | + <label class="flex items-center space-x-2"> |
| 30 | + <span>value:</span> |
| 31 | + <input v-model="showModal" type="checkbox" /> |
| 32 | + </label> |
| 33 | + <label class="flex items-center space-x-2"> |
| 34 | + <span>ssr:</span> |
| 35 | + <input v-model="ssr" type="checkbox" /> |
| 36 | + </label> |
| 37 | + |
| 38 | + <label class="flex items-center space-x-2"> |
| 39 | + <span>lockScroll:</span> |
| 40 | + <input v-model="lockScroll" type="checkbox" /> |
| 41 | + </label> |
| 42 | + <label class="flex items-center space-x-2"> |
| 43 | + <span>hideOverlay:</span> |
| 44 | + <input v-model="hideOverlay" type="checkbox" /> |
| 45 | + </label> |
| 46 | + <label class="flex items-center space-x-2"> |
| 47 | + <span>clickToClose:</span> |
| 48 | + <input v-model="clickToClose" type="checkbox" /> |
| 49 | + </label> |
| 50 | + <label class="flex items-center space-x-2"> |
| 51 | + <span>preventClick:</span> |
| 52 | + <input v-model="preventClick" type="checkbox" /> |
| 53 | + </label> |
| 54 | + <label class="flex items-center space-x-2"> |
| 55 | + <span>transition:</span> |
| 56 | + <input v-model="transition" type="checkbox" /> |
| 57 | + </label> |
| 58 | + <label class="flex items-center space-x-2"> |
| 59 | + <span>overlayTransition:</span> |
| 60 | + <input v-model="overlayTransition" type="checkbox" /> |
| 61 | + </label> |
| 62 | + <label class="flex items-center space-x-2"> |
| 63 | + <span>zIndexBase:</span> |
| 64 | + <input |
| 65 | + v-model="zIndexBase" |
| 66 | + class="w-20 pl-2 dark:text-black rounded focus:outline-none" |
| 67 | + type="number" |
| 68 | + /> |
| 69 | + </label> |
| 70 | + <div class="flex items-center space-x-2"> |
| 71 | + <label class="flex items-center space-x-2"> |
| 72 | + <input v-model="allowZIndex" type="checkbox" /> |
| 73 | + <span>zIndex:</span> |
| 74 | + </label> |
| 75 | + <input |
| 76 | + v-model="zIndex" |
| 77 | + type="number" |
| 78 | + class="w-20 pl-2 dark:text-black rounded focus:outline-none" |
| 79 | + :disabled="!allowZIndex" |
| 80 | + /> |
| 81 | + </div> |
| 82 | + <label class="flex items-center space-x-2"> |
| 83 | + <span>attach:</span> |
| 84 | + <input v-model="attach" type="checkbox" /> |
| 85 | + </label> |
| 86 | + </div> |
| 87 | + <h4>Attach area:</h4> |
| 88 | + <div |
| 89 | + id="attach" |
| 90 | + class="relative w-full h-64 mt-8 p-4 border rounded dark:bg-gray-700" |
| 91 | + > |
| 92 | + <base-button |
| 93 | + @click=" |
| 94 | + attach = '#attach' |
| 95 | + showModal = true |
| 96 | + " |
| 97 | + >Attach to here and open modal</base-button |
| 98 | + > |
| 99 | + </div> |
| 100 | + </div> |
| 101 | +</template> |
| 102 | + |
| 103 | +<script> |
| 104 | +export default { |
| 105 | + data: () => ({ |
| 106 | + showModal: false, |
| 107 | + ssr: true, |
| 108 | + lockScroll: true, |
| 109 | + hideOverlay: false, |
| 110 | + clickToClose: true, |
| 111 | + preventClick: false, |
| 112 | + transition: true, |
| 113 | + overlayTransition: true, |
| 114 | + zIndexBase: 1000, |
| 115 | + allowZIndex: false, |
| 116 | + zIndex: 0, |
| 117 | + attach: false |
| 118 | + }), |
| 119 | + computed: { |
| 120 | + props() { |
| 121 | + return { |
| 122 | + ssr: this.ssr, |
| 123 | + lockScroll: this.lockScroll, |
| 124 | + hideOverlay: this.hideOverlay, |
| 125 | + clickToClose: this.clickToClose, |
| 126 | + preventClick: this.preventClick, |
| 127 | + transition: this.transition ? 'vfm' : '', |
| 128 | + overlayTransition: this.overlayTransition ? 'vfm' : '', |
| 129 | + zIndexBase: this.zIndexBase, |
| 130 | + ...(this.allowZIndex && { zIndex: this.zIndex }), |
| 131 | + attach: this.attach ? '#attach' : false |
| 132 | + } |
| 133 | + } |
| 134 | + } |
| 135 | +} |
| 136 | +</script> |
0 commit comments