<template>
  <div>
    <List v-if="activeName === 'List'" ref="List" />
    <Add v-if="activeName === 'AddOrEdit'" ref="AddOrEdit" />
  </div>
</template>

<script>
import List from './components/list.vue'
import Add from './components/addOrEdit.vue'

export default {
  components: {
    List: List,
    Add: Add
  },
  data() {
    return {
      activeName: 'List',
      id: '',
      tableName: ''
    }
  },
  watch: {
    activeName(val) {
      if (val === 'List') {
        this.$nextTick(() => {
          this.$refs.List.searchList()
        })
      }
    }
  }
}
</script>

<style scoped>
</style>
