更新记录
1.0.1(2021-11-01) 下载此版本
bug修改
1.0.0(2021-07-12) 下载此版本
日期、时间选择器v1.0.0
平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | - | √ | √ | √ | √ | - | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
√ | √ | √ | √ | - | - | - | √ | - | √ | √ |
其他
多语言 | 暗黑模式 | 宽屏模式 |
---|---|---|
× | × | √ |
日期、时间选择器
JS代码
<template>
<view class="cell">
<view class="title">开始时间</view>
<view class="width100" @click="dateOpen('hopeBeginTime', hopeBeginTime)">
<text class="text1" v-if="hopeBeginTime">{{ hopeBeginTime }}</text>
<text class="text1 color3" v-else>请选择</text>
</view>
<my-datetime ref="dateTimePop" @ok="timeOk"></my-datetime>
</view>
</template>
<script>
import myDatetime from '@/components/my-datetime/my-datetime'
export default {
components: {
'my-datetime': myDatetime
},
data() {
return {
hopeBeginTime: '',
dateKey: ''
};
},
methods: {
// 开启弹窗
dateOpen (key, date) {
this.dateKey = key
this.$refs.dateTimePop.open(date || '');
},
// 关闭弹窗
timeOk (str, obj) {
console.log(str, obj)
this[this.dateKey] = str || ''
}
}
}
</script>
| 属性 | 说明 | 默认值 |
| ------------- | ------------- | ------- |
| titleShow | 标题是否显示 | true |
| shownum | 显示几位 | 6 |
shownum: 1年, 2年月,3年月日 ,4年月日时, 5年月日时分,6年月日时分秒 事件ok