Skip to content

Commit

Permalink
feat✨: uni-datetime-picker新增点击日期事件
Browse files Browse the repository at this point in the history
  • Loading branch information
18148764734 committed Apr 24, 2024
1 parent a6b336f commit 8a2cf46
Show file tree
Hide file tree
Showing 5 changed files with 1,070 additions and 1,059 deletions.
11 changes: 7 additions & 4 deletions pages/vue/datetime-picker/datetime-picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</view>
<uni-section :title="'日期时间范围用法:' + '[' + datetimeRange + ']' " type="line"></uni-section>
<view class="example-body">
<uni-datetime-picker v-model="datetimeRange" type="datetimerange" rangeSeparator="" />
<uni-datetime-picker v-model="datetimeRange" type="datetimerange" rangeSeparator="" @calendarClick="calendarClick"/>
</view>
<uni-section :title="'时间戳用法:' + dateTimestamp" type="line"></uni-section>
<view class="example-body">
Expand Down Expand Up @@ -77,9 +77,9 @@
console.log('日期时间范围选:', this.datetimeRange);
}
},
methods: {
show(){
console.log('----show事件:');
methods: {
show(){
console.log('----show事件:');
},
change(e) {
console.log('----change事件:', e);
Expand All @@ -106,6 +106,9 @@
`${addZero ? this.addZero(hour) : hour}:${addZero ? this.addZero(minute) : minute}` :
`${addZero ? this.addZero(hour) : hour}:${addZero ? this.addZero(minute) : minute}:${addZero ? this.addZero(second) : second}`
},
calendarClick(e){
console.log("点击的日期:",JSON.stringify(e))
},
addZero(num) {
if (num < 10) {
num = `0${num}`
Expand Down
2 changes: 2 additions & 0 deletions uni_modules/uni-datetime-picker/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 2.2.34(2024-04-24)
- 新增 日期点击事件,在点击日期时会触发该事件。
## 2.2.33(2024-04-15)
- 修复 抖音小程序事件传递失效bug
## 2.2.32(2024-02-20)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@
/**
* 变化触发
*/
change() {
if (!this.insert) return
change(isSingleChange) {
if (!this.insert && !isSingleChange) return
this.setEmit('change')
},
/**
Expand Down Expand Up @@ -611,7 +611,7 @@
this.tempRange.before = this.cale.multipleStatus.before
this.tempRange.after = this.cale.multipleStatus.after
}
this.change()
this.change(true)
},
changeMonth(type) {
let newDate
Expand Down Expand Up @@ -944,4 +944,4 @@
}
/* #endif */
</style>
</style>
Loading

0 comments on commit 8a2cf46

Please sign in to comment.