Commit 80d3d781 authored by yaya's avatar yaya

feat: 优化账单列表筛选账期默认值

parent 8b7a80fd
...@@ -191,14 +191,19 @@ export default { ...@@ -191,14 +191,19 @@ export default {
} }
}, },
created() { created() {
const date = new Date() this.$set(this.listQuery, 'accountPeriod', this.getPreviousMonthYear())
const year = date.getFullYear()
const month = date.getMonth() + 1
this.$set(this.listQuery, 'accountPeriod', year + '-' + (month < 10 ? `0${month}` : month))
this.getList() this.getList()
}, },
methods: { methods: {
getPreviousMonthYear() {
const now = new Date()
const previousMonth = new Date(now.getFullYear(), now.getMonth() - 1, 1)
const month = previousMonth.getMonth() + 1
const year = previousMonth.getFullYear()
const time = year + '-' + (month < 10 ? `0${month}` : month)
return time
},
handleOnChange(value) { handleOnChange(value) {
console.log('===', value) console.log('===', value)
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment