将字符串’2019-02-05‘转换成2019年2月5日

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/devincob/article/details/86505673
formDate() {
      let str = this.$user.userInfo.registerTime
      let regTimes = []
      if (str) {
        regTimes = str.split('-')
        if (regTimes.length === 3) {
          let year = regTimes[0]
          let month = regTimes[1]
          let date = regTimes[2]
          month = month.replace(/^0/, '')
          date = date.replace(/^0/, '')
          return year + '年' + month + '月' + date + '日'
        }
      }
      return ''
    }

猜你喜欢

转载自blog.csdn.net/devincob/article/details/86505673
今日推荐