<template>
  <li class="components" :class="{'active': show}">
    <span>{{item.firstName}}</span>
    <span>{{item.words}}</span>
  </li>
</template>

<script>
export default {
  name: 'components',
  props: ['item'],
  data () {
    return {
      show: false,
      timer: null,
      showTimeTamp: 0
    }
  },
  // watch: {
  //   item (newVal, oldVal) {
  //     if (!oldVal) {
  //       this.resetTime()
  //       return
  //     }
  //     window.clearInterval(this.timer)
  //     this.timer = null
  //     this.showTimeTamp = 0
  //     this.resetTime()
  //   }
  // },
  computed: {
  },
  components: {
  },
  created () {
    // this.resetTime()
  },
  mounted () {
    this.$nextTick(() => {
    })
  },
  methods: {
    // resetTime () {
    //   this.show = true
    //   this.timer = window.setInterval(() => {
    //     this.showTimeTamp += 100
    //     if (this.showTimeTamp >= 5000) {
    //       window.clearInterval(this.timer)
    //       this.timer = null
    //       this.showTimeTamp = 0
    //       this.show = false
    //     }
    //   }, 100)
    // }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.components {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.15);
  margin: 1.8vh auto 0;
  padding: 9vh 0;
  transform: translateY(100vh);
  -webkit-transform: translateY(100vh);
  transition: all 0.3s linear;
  -webkit-transition: all 0.3s linear;
  &:first-child {
    margin-top: 0;
  }
  &.active {
    transform: translateY(0);
    -webkit-transform: translateY(0);
  }
  span {
    width: 100%;
    display: block;
    color: #fff;
    text-align: center;
    line-height: 1.45;
    font-size: 2.3vw;
    &:first-child {
      font-size: 2.8vw;
      line-height: 1.3;
    }
  }
}
</style>
