<template>
  <div class="app-main">
    <transition name="el-fade-in-linear" mode="out-in">
      <keep-alive :include="list">
        <router-view :key="decodeURIComponent($route.fullPath)"></router-view>
      </keep-alive>
    </transition>
  </div>
</template>

<script>
import { isTags, getTile } from '@/utils/tags'
export default {
  name: 'AppMain',
  data() {
    return {
      list: ['CarrierListExecutionRegistrationAircraft', 'CarrierListMachineryPreparation', 'CarrierListMachineryPreparationLook', 'carrierAllAuditLook', 'CarrierListShipping', 'SailingMaterial', 'OutboundRecord', 'WarehousingRecord']
    }
  },
  watch: {
    $route(to, from) {
      if (!isTags(to.path)) return
      const { fullPath, meta, name, params, path, query } = to
      this.$store.commit('app/addTagsViewList', {
        fullPath,
        meta,
        name,
        params,
        path,
        query,
        title: getTile(to)
      })
    },
    immediate: true
  }
}
</script>

<style lang="scss">
@import './index.scss';
</style>
