<template>
  <div class="app-container">
    <transition name="el-zoom-in-center">
      <role-list v-if="options.showList" @showCard="showCard"></role-list>
    </transition>
    <transition name="el-zoom-in-top">
      <role-add v-if="options.showAdd" @showCard="showCard"></role-add>
    </transition>
    <transition name="el-zoom-in-top">
      <role-edit v-if="options.showEdit" :id="options.id" @showCard="showCard"></role-edit>
    </transition>
    <transition name="el-zoom-in-bottom">
      <role-detail v-if="options.showDetail" :id="options.id" @showCard="showCard"></role-detail>
    </transition>
  </div>
</template>

<script>
import RoleList from './RoleList'
import RoleAdd from './RoleAdd'
import RoleEdit from './RoleEdit'
import RoleDetail from './RoleDetail'

export default {
  name: 'Role',
  components: { RoleList, RoleAdd, RoleEdit, RoleDetail },
  data () {
    return {
      options: {
        id: undefined,
        showList: true,
        showAdd: false,
        showEdit: false,
        showDetail: false
      }
    }
  },
  methods: {
    showCard (data) {
      Object.assign(this.options, data);
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
