<template>
  <div class="layout-container">
    <!-- <van-nav-bar :title="title" left-arrow @click-left="handleNavbarLeftClick" class="nav">
      <template #right>
        <van-icon name="ellipsis" size="18" />
      </template>
</van-nav-bar> -->
    <router-view />
  </div>
</template>

<script>
import { getEcosystem, getAlias } from '@/assets/js/utils/ecosystem'

export default {
  name: 'layout',
  created() {
    // console.log(this.$route);
  },
  computed: {
    title() {
      const name = this.$route.name
      let title = this.$route.meta.title
      if (name === "service") {
        const ecosystem = this.$route.params.ecosystem
        title = getAlias(ecosystem)
      }
      return title
    }
  },
  watch: {
    $route(to, from) {
      document.title = this.title
    }
  },
  methods: {
    handleNavbarLeftClick() {
      this.$router.go(-1)
    }
  }
}
</script>

<style>
.nav {
  position: sticky;
  top: 0;
}
</style>