更新记录
1.0.0(2022-06-06) 下载此版本
Attributes
类型 | 说明 | 数据类型 | 默认值说明 |
---|---|---|---|
modelValue | 月历组件值 | String, Number, Date | '' |
visible | 弹窗显示 | Boolean | false |
disabledDate | 禁用的日期 | Function | 默认禁用大于当前时间后的年月,默认值在下面 |
默认的 disabledDate 函数
const disabledDate = (year, month) => {
const date = new Date()
if (year > date.getFullYear()) {
return true
}
if (year === date.getFullYear() && month > date.getMonth() + 1) {
return true
}
return false
}
Events
confirm 弹窗点击确认事件
回调参数
{
subVisible: false,
yarn: state.year,
month: state.month,
value: state.year + '-' + state.month
}
Vue 版本支持
仅支持 vue3.2 以上版本
使用说明
组件依赖 sass
@dcloudio/uni-ui
请在项目中提前安装sass
和@dcloudio/uni-ui
,并且配置好 @dcloudio/uni-ui
的导入。
平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
× | √ | √ | √ | √ | - | - | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
√ | - | - | - | - | - | - | - | - | - | - |
其他
多语言 | 暗黑模式 | 宽屏模式 |
---|---|---|
× | × | √ |
SelectMonth 选择年月份组件
使用示例
<template>
<view class="content">
<button hover-class="button-hover" @click="handleShow">显示</button>
{{ state.month }}
<!-- 选择月份组件 -->
<SelectMonth v-model="state.month" v-model:visible="state.visible" />
</view>
</template>
<script setup>
import { reactive } from 'vue'
import SelectMonth from '../../components/select-month'
const state = reactive({
month: '',
visible: false
})
const handleShow = () => {
state.visible = true
}
</script>
<style></style>
Attributes
类型 | 说明 | 数据类型 | 默认值说明 |
---|---|---|---|
modelValue | 月历组件值 | String, Number, Date | '' |
visible | 弹窗显示 | Boolean | false |
disabledDate | 禁用的日期 | Function | 默认禁用大于当前时间后的年月,默认值在下面 |
默认的 disabledDate 函数
const disabledDate = (year, month) => {
const date = new Date()
if (year > date.getFullYear()) {
return true
}
if (year === date.getFullYear() && month > date.getMonth() + 1) {
return true
}
return false
}
Events
confirm 弹窗点击确认事件
回调参数
{
subVisible: false,
yarn: state.year,
month: state.month,
value: state.year + '-' + state.month
}
Vue 版本支持
仅支持 vue3.2 以上版本
使用说明
组件依赖 sass
@dcloudio/uni-ui
请在项目中提前安装sass
和@dcloudio/uni-ui
,并且配置好 @dcloudio/uni-ui
的导入。