<template>
  <div id="app">
    <keep-alive :include="keepAliveViews">
      <router-view></router-view>
    </keep-alive>
  </div>
</template>

<script>
  export default {
    name: 'app',
    data() {
      return {
        keepAliveViews: ['Carry', 'UserCarry'] // 缓存视图列表
      }
    },
    mounted() {
      console.log(window.location.href);
      this.andriodInputBug();
    },
    methods: {
      //解决安卓点击input，弹出键盘挡住input的问题
      andriodInputBug() {
        if (/Android/gi.test(navigator.userAgent)) {
          window.addEventListener('resize', function () {
            if (document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == 'TEXTAREA') {
              window.setTimeout(function () {
                document.activeElement.scrollIntoViewIfNeeded();
              }, 0);
            }
          })
        }
      }
    }
  }
</script>

<style lang="scss" scoped>
  #app {
    height: 100%;
    -webkit-overflow-scrolling: touch;
  }
</style>
