All files / vue-koa-demo/src App.vue

0% Statements 0/9
0% Branches 0/4
0% Functions 0/3
0% Lines 0/9
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60                                                                                                                       
<template>
  <div id="app">
    <todo-header :username="username" @setUserName="setUserName"/>
    <router-view @setUserName="setUserName"/>
    <todo-footer/>
  </div>
</template>
 
<script>
import TodoHeader from '@/components/Todoheader'
import TodoFooter from '@/components/Todofooter'
 
export default {
  name: 'App',
  data () {
    return {
      username: sessionStorage.username || ''
    }
  },
  methods: {
    setUserName (payload) {
      this.username = payload.username
    }
  },
  created () {
    if (sessionStorage.username) {
      this.$router.replace('/todo')
    }
  },
  components: {
    TodoHeader,
    TodoFooter
  }
}
</script>
 
<style>
* {
  margin: 0;
  padding: 0;
}
html, body {
  width: 100%;
  height: 100%;
  background: #f9f9f9;
}
#app {
  width: 100%;
  height: 100%;
  min-height: 780px;
  min-width: 800px;
  text-align: center;
  display: flex;
  flex-direction: column;
}
body::-webkit-scrollbar {
  display: none;
}
</style>