<template>
  <div id="app">
    <div id="nav">
      <span @click="toNewsHome" style="cursor:pointer;">资讯首页</span>><router-link to="/">风口研报</router-link><span v-if="purchased">><router-link to="/purchased">我的付费订单</router-link></span>
    </div>
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive"/>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive"/>
  </div>
</template>
<script>
  export default {
    name: 'App',
    data() {
      return {
        purchased: false
      }
    },
    watch: {
      $route(to, from) {
        console.log(to, from)
        if(to.path === '/purchased') {
          this.purchased = true;
        }else {
          this.purchased = false;
        }
      }
    },
    methods: {
      toNewsHome () {
        window.location.href = 'http://www.treeid/chromeview##homepath##yht/index.html#/news'
      },
    },
  }
</script>
<style>
body{
  background-color: #0f0f12;
  display: flex;
  justify-content: center;
  border: 0px;
  margin: 0px;
}
body ::-webkit-scrollbar {
  background-color: #15171E;
  width: 8px;
  height: 8px;
}

body ::-webkit-scrollbar-thumb {
  background-color: #4E515D;
  border-radius: 6px;
}
* {
  box-sizing: border-box;
}
p,
h1,
h2,
h3,
h4,
button {
  margin: 0;
  padding: 0;
}
i,
em {
  font-style: normal;
}
#app {
  font-family: 'Microsoft YaHei', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  width: 1200px;
}

#nav {
  width: 1200px;
  height: 30px;
  background-color: #21242c;
  color: #bfc0c3;
  padding-left: 30px;
  line-height: 30px;
  box-sizing: border-box;
  margin-bottom: 1px;
}

#nav a {
  text-decoration: none;
  color: #bfc0c3;
}
#nav a:hover, #nav span:hover{
   color: #1496f5;
}

/* #nav a.router-link-exact-active {
  color: #42b983;
} */
</style>
