<text style="padding-right: 10px; color: #333; font-size: 28px" slot="value">{{birthdayDate}}</text>

这里名称,不需要定义(实际是函数名)

// 时间戳转日期
add0 (m) {
return m < 10 ? '0' + m:m
},
getDate (item) {
var time = new Date(item) 
var year = time.getFullYear()
var month = time.getMonth() + 1
var date = time.getDate()
return year + '-' + this.add0(month) + '-' + this.add0(date)
}

重构:

computed: {
        birthdayDate() {
            return this.getDate(this.user.birthday)
        }
    }

注意:birthdayDate 是转换过的名称,this.getDate(this.date) 转换函数内的名称是原有的名称

 -------------------------------------

转时间戳

getTimestamp (mytime){
let dateTmp = mytime.replace(/-/g,'/')
return Date.parse(dateTmp)
},

相关文章:

  • 2022-01-28
  • 2022-02-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-05-01
  • 2022-12-23
相关资源
相似解决方案