point.js 949 Bytes
export default {
  data() {
    return {
      year: '',
      month: '',
      currentMonth: ''
    }
  },
  mounted() {
    const year = new Date().getFullYear()
    const month = new Date().getMonth() + 1
    const day = new Date().getDate()
    this.year = year
    this.month = month
    this.currentMonth = month
    this.getDetail && this.getDetail(`${this.year}-${this.month}`, day)
  },
  methods: {
    back() {
      console.log(88)
      this.$emit('backHome')
    },
    prevTab() {
      this.month = this.month - 1
      if (this.month < 1) {
        this.month = 12
        this.year = this.year - 1
      }
      this.updateDetail && this.updateDetail(`${this.year}-${this.month}`)
    },
    nextTab() {
      this.month = this.month + 1
      // if (this.month < 1) {
      //   this.month = 12
      //   this.year = this.year - 1
      // }
      this.updateDetail && this.updateDetail(`${this.year}-${this.month}`)
    }
  }
}