安装chinese-lunar-calendar
npm install --save chinese-lunar-calendar
<script>
import { getLunar } from 'chinese-lunar-calendar'
export default {
data() {
return {
getLunarDay: '',
year: new Date().getFullYear(),
month: new Date().getMonth() + 1,
date: new Date().getDate()
}
},
mounted() {
// 获取农历
this.getLunarDay = getLunar(this.year, this.month, this.date)
console.log(this.getLunarDay)
}
}
</script>