dev
wangchen 2023-07-10 18:00:11 +08:00
parent 720b33a1d2
commit 1baafb2a63
6 changed files with 43 additions and 38 deletions

View File

@ -81,7 +81,7 @@
</view> </view>
<view class="col"> <view class="col">
<view class="progress-box"> <view class="progress-box">
<progress percent="20" show-info stroke-width="3" /> <progress :percent="item" show-info stroke-width="3" />
</view> </view>
</view> </view>
</view> </view>

View File

@ -1,21 +1,23 @@
## 1.4.102023-04-10
- 修复 某些情况 monthSwitch 未触发的Bug
## 1.4.92023-02-02 ## 1.4.92023-02-02
- 修复 某些情况切换月份错误问题 - 修复 某些情况切换月份错误的Bug
## 1.4.82023-01-30 ## 1.4.82023-01-30
- 修复 某些情况切换月份错误问题 - 修复 某些情况切换月份错误的Bug [详情](https://ask.dcloud.net.cn/question/161964)
## 1.4.72022-09-16 ## 1.4.72022-09-16
- 可以使用 uni-scss 控制主题色 - 优化 支持使用 uni-scss 控制主题色
## 1.4.62022-09-08 ## 1.4.62022-09-08
- fix: 表头年月切换导致改变当前日期为选择月1号且未触发change事件 - 修复 表头年月切换导致改变当前日期为选择月1号且未触发change事件的Bug
## 1.4.52022-02-25 ## 1.4.52022-02-25
- 修复 条件编译 nvue 不支持的 css 样式 - 修复 条件编译 nvue 不支持的 css 样式的Bug
## 1.4.42022-02-25 ## 1.4.42022-02-25
- 修复 条件编译 nvue 不支持的 css 样式 - 修复 条件编译 nvue 不支持的 css 样式的Bug
## 1.4.32021-09-22 ## 1.4.32021-09-22
- 修复 startDate、 endDate 属性失效的 bug - 修复 startDate、 endDate 属性失效的Bug
## 1.4.22021-08-24 ## 1.4.22021-08-24
- 新增 支持国际化 - 新增 支持国际化
## 1.4.12021-08-05 ## 1.4.12021-08-05
- 修复 弹出层被 tabbar 遮盖 bug - 修复 弹出层被 tabbar 遮盖的Bug
## 1.4.02021-07-30 ## 1.4.02021-07-30
- 组件兼容 vue3如何创建vue3项目详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3如何创建vue3项目详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.3.162021-05-12 ## 1.3.162021-05-12

View File

@ -51,11 +51,10 @@
</template> </template>
<script> <script>
import { import { initVueI18n } from '@dcloudio/uni-i18n'
initVueI18n import i18nMessages from './i18n/index.js'
} from '@dcloudio/uni-i18n' const { t } = initVueI18n(i18nMessages)
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
export default { export default {
emits:['change'], emits:['change'],
props: { props: {

View File

@ -20,7 +20,7 @@
<view class="uni-calendar__header-btn-box" @click.stop="next"> <view class="uni-calendar__header-btn-box" @click.stop="next">
<view class="uni-calendar__header-btn uni-calendar--right"></view> <view class="uni-calendar__header-btn uni-calendar--right"></view>
</view> </view>
<text class="uni-calendar__backtoday" @click="backtoday">{{todayText}}</text> <text class="uni-calendar__backtoday" @click="backToday">{{todayText}}</text>
</view> </view>
<view class="uni-calendar__box"> <view class="uni-calendar__box">
@ -62,12 +62,12 @@
<script> <script>
import Calendar from './util.js'; import Calendar from './util.js';
import calendarItem from './uni-calendar-item.vue' import CalendarItem from './uni-calendar-item.vue'
import {
initVueI18n import { initVueI18n } from '@dcloudio/uni-i18n'
} from '@dcloudio/uni-i18n' import i18nMessages from './i18n/index.js'
import messages from './i18n/index.js' const { t } = initVueI18n(i18nMessages)
const { t } = initVueI18n(messages)
/** /**
* Calendar 日历 * Calendar 日历
* @description 日历组件可以查看日期选择任意范围内的日期打点操作常用场景如酒店日期预订火车机票选择购买日期上下班打卡等 * @description 日历组件可以查看日期选择任意范围内的日期打点操作常用场景如酒店日期预订火车机票选择购买日期上下班打卡等
@ -90,7 +90,7 @@
*/ */
export default { export default {
components: { components: {
calendarItem CalendarItem
}, },
emits:['close','confirm','change','monthSwitch'], emits:['close','confirm','change','monthSwitch'],
props: { props: {
@ -199,26 +199,26 @@
} }
}, },
created() { created() {
//
this.cale = new Calendar({ this.cale = new Calendar({
// date: new Date(),
selected: this.selected, selected: this.selected,
startDate: this.startDate, startDate: this.startDate,
endDate: this.endDate, endDate: this.endDate,
range: this.range, range: this.range,
}) })
//
// this.cale.setDate(this.date)
this.init(this.date) this.init(this.date)
// this.setDay
}, },
methods: { methods: {
// 穿 // 穿
clean() {}, clean() {},
bindDateChange(e) { bindDateChange(e) {
const value = e.detail.value + '-1' const value = e.detail.value + '-1'
console.log(this.cale.getDate(value));
this.setDate(value) this.setDate(value)
const { year,month } = this.cale.getDate(value)
this.$emit('monthSwitch', {
year,
month
})
}, },
/** /**
* 初始化日期显示 * 初始化日期显示
@ -323,11 +323,16 @@
/** /**
* 回到今天 * 回到今天
*/ */
backtoday() { backToday() {
console.log(this.cale.getDate(new Date()).fullDate); const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`
let date = this.cale.getDate(new Date()).fullDate const date = this.cale.getDate(new Date())
// this.cale.setDate(date) const todayYearMonth = `${date.year}-${date.month}`
this.init(date)
if(nowYearMonth !== todayYearMonth) {
this.monthSwitch()
}
this.init(date.fullDate)
this.change() this.change()
}, },
/** /**
@ -446,7 +451,6 @@
.uni-calendar--fixed-width { .uni-calendar--fixed-width {
width: 50px; width: 50px;
// padding: 0 15px;
} }
.uni-calendar__backtoday { .uni-calendar__backtoday {

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-calendar", "id": "uni-calendar",
"displayName": "uni-calendar 日历", "displayName": "uni-calendar 日历",
"version": "1.4.9", "version": "1.4.10",
"description": "日历组件", "description": "日历组件",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",

View File

@ -77,7 +77,7 @@ export default {
### Calendar Props ### Calendar Props
| 属性名 | 类型 | 默认值| 说明 | | 属性名 | 类型 | 默认值| 说明 |
| | | | - | - | - | - |
| date | String |- | 自定义当前时间,默认为今天 | | date | String |- | 自定义当前时间,默认为今天 |
| lunar | Boolean | false | 显示农历 | | lunar | Boolean | false | 显示农历 |
| startDate | String |- | 日期选择范围-开始日期 | | startDate | String |- | 日期选择范围-开始日期 |
@ -91,7 +91,7 @@ export default {
### Calendar Events ### Calendar Events
| 事件名 | 说明 |返回值| | 事件名 | 说明 |返回值|
| | | | | - | - | - |
| open | 弹出日历组件,`insert :false` 时生效|- | | open | 弹出日历组件,`insert :false` 时生效|- |