1.安装 npm install dayjs 2.引用并挂载 需要在main.js中引入并挂载 2.1 引入 import dayjs from 'dayjs' 2.2 挂载全局 Vue.prototype.$dayjs = dayjs 3.在具体页面使用 this.times=res.Date.time; this.times = this.$DayJs(this.times).format("YYYY-MM-DD");