getage() {
      var birthdays = new Date(this.birthday.replace(/-/g, "/"));
      var d = new Date();
      var age =
        d.getFullYear() -
        birthdays.getFullYear() -
        (d.getMonth() < birthdays.getMonth() ||
        (d.getMonth() == birthdays.getMonth() &&
          d.getDate() < birthdays.getDate())
          ? 1
          : 0);
      this.userAge = age;
    },

 

转载于:https://www.cnblogs.com/huanhuan55/p/9920536.html

Logo

前往低代码交流专区

更多推荐