<template>
  <div>
    <keep-alive>
      <List v-show="activeName==='List'" ref="list" />
    </keep-alive>
    <Edit v-if="activeName==='Edit'" />
  </div>
</template>

<script>
import List from './components/list'
import Edit from './components/edit'

export default {
  components: {
    List: List,
    Edit: Edit
  },
  data() {
    return {
      activeName: 'List'
    }
  },
  watch: {
    activeName(val) {
      if (val === 'List') {
        this.$refs.list.getList()
        this.$refs.list.getTreeList()
      }
    }
  }
}
</script>

<style scoped>
</style>

