modal implementation #12

Merged
vincent merged 10 commits from dev into master 2019-05-11 14:21:09 +00:00
4 changed files with 23 additions and 16 deletions
Showing only changes of commit a0481fb8eb - Show all commits

View File

@ -73,8 +73,8 @@
</div>
</div>
</div>
<modalLogin v-bind:show="showModalLogin" @close="showModalLogin = false" />
<modal v-bind:show="showModal" @close="showModal = false">{{modalmessage}}</modal>
<modalLogin v-show="showModalLogin" @close="showModalLogin = false" />
<modal v-show="showModal" @close="showModal = false">{{modalmessage}}</modal>
</div>
</template>
@ -82,6 +82,7 @@
import { putparsechaine } from '../api';
import modalLogin from './modalLogin'
import modal from './modal'
import { EventBus } from '../utils';
export default {
name: 'chainetv',
@ -145,6 +146,11 @@ export default {
return true;
},
},
mounted() {
EventBus.$on('showmodallogin',()=>{
this.showModalLogin=true;
})
},
};
</script>
<style >

View File

@ -1,6 +1,6 @@
<template>
<div>
<div v-bind:class="{'is-active':show}" class="modal">
<div class="modal is-active">
<div class="modal-background"></div>
<button class="modal-close is-large" aria-label="close" @click="$emit('close')"></button>
<div class="modal-content box">
@ -12,9 +12,7 @@
<script>
export default {
props:{
show:false,
},
};
</script>

View File

@ -1,13 +1,13 @@
<!-- components/Login.vue -->
<template>
<modal v-bind:show="show" @close="$emit('close')">
<modal @close="$emit('close')">
<div class="hero is-success">
<div class="hero-body has-text-centered">
<h2 class="title">Login</h2>
<p class="subtitle error-msg">{{ errorMsg }}</p>
</div>
</div>
<section class="section">
<section v-on:keyup.enter="authenticate" class="section">
<div class="field">
<label class="label" for="name">Name:</label>
<div class="control">
@ -32,9 +32,6 @@
import { EventBus } from '../utils';
import modal from './modal'
export default {
props:{
show:false,
},
data() {
return {
name: "",

View File

@ -3,6 +3,7 @@ import Router from 'vue-router';
import ping from '@/components/ping';
import chainetv from '@/components/chainetv';
import store from '@/store';
import { EventBus } from '../utils';
Vue.use(Router);
export default new Router({
@ -17,12 +18,17 @@ export default new Router({
name: 'ping',
component: ping,
beforeEnter(to, from, next) {
if (!store.getters.isAuthenticated) {
next('/')
} else {
next();
}
autent(to,from,next)
},
},
],
});
function autent(to,from,next) {
if (!store.getters.isAuthenticated) {
next('/')
EventBus.$emit("showmodallogin")
} else {
next();
}
}