mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2025-12-29 13:21:27 +00:00
Added more examples
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<demo-error-modal/>
|
<demo-error-modal/>
|
||||||
|
<demo-login-modal/>
|
||||||
<modal name="example-modal"
|
<modal name="example-modal"
|
||||||
transition="nice-modal-fade"
|
transition="nice-modal-fade"
|
||||||
:min-width="200"
|
:min-width="200"
|
||||||
@@ -38,7 +39,8 @@
|
|||||||
<button @click="show(false, true, false)">Adaptive</button>
|
<button @click="show(false, true, false)">Adaptive</button>
|
||||||
<button @click="show(true, true, false)">Mixed</button>
|
<button @click="show(true, true, false)">Mixed</button>
|
||||||
<button @click="show(false, false, true)">Draggable</button>
|
<button @click="show(false, false, true)">Draggable</button>
|
||||||
<button @click="showErrorModal">Demo: Error handling</button>
|
<button @click="$modal.show('error-modal')">Demo: Error handling</button>
|
||||||
|
<button @click="$modal.show('demo-login')">Demo: Login</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<props-table />
|
<props-table />
|
||||||
@@ -49,13 +51,15 @@
|
|||||||
import ModesTable from './components/ModesTable.vue'
|
import ModesTable from './components/ModesTable.vue'
|
||||||
import PropsTable from './components/PropsTable.vue'
|
import PropsTable from './components/PropsTable.vue'
|
||||||
import DemoErrorModal from './components/DemoErrorModal.vue'
|
import DemoErrorModal from './components/DemoErrorModal.vue'
|
||||||
|
import DemoLoginModal from './components/DemoLoginModal.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
components: {
|
components: {
|
||||||
ModesTable,
|
ModesTable,
|
||||||
PropsTable,
|
PropsTable,
|
||||||
DemoErrorModal
|
DemoErrorModal,
|
||||||
|
DemoLoginModal
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -76,10 +80,6 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$modal.show('example-modal')
|
this.$modal.show('example-modal')
|
||||||
})
|
})
|
||||||
},
|
|
||||||
|
|
||||||
showErrorModal () {
|
|
||||||
this.$modal.show('error-modal')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
:pivot-y="0.2"
|
:pivot-y="0.2"
|
||||||
:width="400"
|
:width="400"
|
||||||
:height="300"
|
:height="300"
|
||||||
|
@before-open="beforeOpen"
|
||||||
@before-close="beforeClose">
|
@before-close="beforeClose">
|
||||||
<div class="error-modal-content">
|
<div class="error-modal-content">
|
||||||
<div class="bugs-label">bugs: {{bugCount}}</div>
|
<div class="bugs-label">bugs: {{bugCount}}</div>
|
||||||
@@ -37,6 +38,10 @@ export default {
|
|||||||
this.hasBugs = false
|
this.hasBugs = false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beforeOpen (event) {
|
||||||
|
this.bugCount = Math.round(Math.random() * 3) + 1
|
||||||
|
},
|
||||||
|
|
||||||
beforeClose (event) {
|
beforeClose (event) {
|
||||||
if (this.bugCount > 0) {
|
if (this.bugCount > 0) {
|
||||||
this.hasBugs = true
|
this.hasBugs = true
|
||||||
@@ -50,7 +55,8 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.modal.error-modal {
|
|
||||||
|
.error-modal {
|
||||||
transition: box-shadow 1s;
|
transition: box-shadow 1s;
|
||||||
|
|
||||||
&.has-bugs {
|
&.has-bugs {
|
||||||
|
|||||||
216
demo/src/components/DemoLoginModal.vue
Normal file
216
demo/src/components/DemoLoginModal.vue
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
<template>
|
||||||
|
<modal name="demo-login" transition="pop-out" :width="656" :height="400">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-part" id="bp-left">
|
||||||
|
<div class="partition" id="partition-register">
|
||||||
|
<div class="partition-title">CREATE ACCOUNT</div>
|
||||||
|
<div class="partition-form">
|
||||||
|
<form autocomplete="false">
|
||||||
|
|
||||||
|
<div class="autocomplete-fix">
|
||||||
|
<input type="password">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input id="n-email" type="text" placeholder="Email">
|
||||||
|
<input id="n-username" type="text" placeholder="Username">
|
||||||
|
<input id="n-password2" type="password" placeholder="Password">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div style="margin-top: 42px">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="button-set">
|
||||||
|
<button id="goto-signin-btn">Sign In</button>
|
||||||
|
<button id="register-btn">Register</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="large-btn github-btn">connect with <span>github</span></button>
|
||||||
|
<button class="large-btn facebook-btn">connect with <span>facebook</span></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box-part" id="bp-right">
|
||||||
|
<div class="box-messages">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</modal>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'DemoLoginModal'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
$background_color: #404142;
|
||||||
|
$github_color: #DBA226;
|
||||||
|
$facebook_color: #3880FF;
|
||||||
|
|
||||||
|
.box {
|
||||||
|
background: white;
|
||||||
|
overflow: hidden;
|
||||||
|
width: 656px;
|
||||||
|
height: 400px;
|
||||||
|
border-radius: 2px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
box-shadow: 0 0 40px black;
|
||||||
|
color: #8b8c8d;
|
||||||
|
font-size: 0;
|
||||||
|
|
||||||
|
.box-part {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
vertical-align: top;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 100%;
|
||||||
|
width: 50%;
|
||||||
|
|
||||||
|
&#bp-right {
|
||||||
|
background: url("/static/panorama.jpg") no-repeat top left;
|
||||||
|
border-left: 1px solid #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-messages {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-error-message {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
height: 0;
|
||||||
|
line-height: 32px;
|
||||||
|
padding: 0 12px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 11px;
|
||||||
|
color: white;
|
||||||
|
background: #F38181;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partition {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.partition-title {
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 30px;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
.partition-form {
|
||||||
|
padding: 0 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=password],
|
||||||
|
input[type=text] {
|
||||||
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 2;
|
||||||
|
border: 0;
|
||||||
|
border-bottom: 1px solid #DDDEDF;
|
||||||
|
padding: 4px 8px;
|
||||||
|
font-family: inherit;
|
||||||
|
transition: 0.5s all;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background: white;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 10px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-family: "Open Sans", sans-serif;
|
||||||
|
font-weight: 400;
|
||||||
|
min-width: 140px;
|
||||||
|
margin-top: 8px;
|
||||||
|
color: #8b8c8d;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 1px solid #DDDEDF;
|
||||||
|
text-transform: uppercase;
|
||||||
|
transition: 0.1s all;
|
||||||
|
font-size: 10px;
|
||||||
|
outline: none;
|
||||||
|
&:hover {
|
||||||
|
border-color: mix(#DDDEDF, black, 90%);
|
||||||
|
color: mix(#8b8c8d, black, 80%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.large-btn {
|
||||||
|
width: 100%;
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-set {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#register-btn,
|
||||||
|
#signin-btn {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.facebook-btn {
|
||||||
|
border-color: $facebook_color;
|
||||||
|
color: $facebook_color;
|
||||||
|
&:hover {
|
||||||
|
border-color: $facebook_color;
|
||||||
|
background: $facebook_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-btn {
|
||||||
|
border-color: $github_color;
|
||||||
|
color: $github_color;
|
||||||
|
&:hover {
|
||||||
|
border-color: $github_color;
|
||||||
|
background: $github_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.autocomplete-fix {
|
||||||
|
position: absolute;
|
||||||
|
visibility: hidden;
|
||||||
|
overflow: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pop-out-enter-active,
|
||||||
|
.pop-out-leave-active {
|
||||||
|
transition: all 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pop-out-enter,
|
||||||
|
.pop-out-leave-active {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(24px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
0
demo/static/.gkeep
Normal file
0
demo/static/.gkeep
Normal file
BIN
demo/static/panorama.jpg
Normal file
BIN
demo/static/panorama.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
@@ -51,7 +51,7 @@
|
|||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
transition: {
|
transition: {
|
||||||
type: String,
|
type: String
|
||||||
},
|
},
|
||||||
classes: {
|
classes: {
|
||||||
type: [String, Array],
|
type: [String, Array],
|
||||||
|
|||||||
Reference in New Issue
Block a user