<template>
  <div id="app" :class="isElder?'elder':''">
    <keep-alive>
      <router-view v-if="this.$route.meta.keepAlive" @setElder="setElder" />
    </keep-alive>

    <router-view v-if="!this.$route.meta.keepAlive" @setElder="setElder" />
  </div>
</template>
<script>
export default {
  data () {
    return {
      isElder: false
    }
  },
  mounted () {
    
    ZWJSBridge.onReady(() => {
      console.log('初始化完成后，执行bridge方法')
      
    })
    
    const isElder = sessionStorage.getItem('isElder')
    if (isElder) {
      this.isElder = true
    } else {
      ZWJSBridge.getUiStyle({})
        .then((result) => {
          console.log(result);
          if (result.uiStyle == 'elder') {
            this.isElder = true;
            sessionStorage.setItem('isElder', 1)
          }
        })
        //浙里办APP 6.11.0 版本以下版本标准模式兼容
        .catch((error) => { console.log(error); });
    }
  },
  methods: {
    setElder (e) {
      this.isElder = e
    }
  }
}
</script>
<style>
html,
body,
#app {
  height: 100%;
  color: #333333;
  font-size: 0;
}
p {
  margin: 0;
}
</style>
