js年度循环-LMLPHP

<template>
  <div>
    <div v-for="item in year" :key="item.value">{{item.value}}</div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      year: []
    }
  },
  mounted () {
    this.btn()
  },
  methods: {
    btn () {
      let years = new Date().getFullYear()
      for (let i = 1; i < 10; i++) {
        this.year.push({ value: years + i })
      }
    }
  }
}
</script>

<style>
</style>
10-31 17:44