Vue Datepicker组件选择了日期和时间

这篇博客介绍了@livelybone/vue-datepicker组件,它是一个包含日期、日期时间、时间选择功能的Vue日期选择器。支持pkg.module,可在项目中实现摇树优化。文章详细阐述了安装、注册方法,并列出了组件的属性、事件和样式定制选项。
摘要由CSDN通过智能技术生成

@ livelybone / vue-datepicker (@livelybone/vue-datepicker)

A vue datepicker, includes date, datetime, time

Vue日期选择器,包括日期,日期时间,时间

pkg.module supported, which means that you can apply tree-shaking in you project

支持pkg.module,这意味着您可以在项目中应用摇树

安装 (Installation)

npm i -S @livelybone/vue-datepicker

寄存器 (Register)

// import all
import {Datepicker, Timepicker, DatetimePicker} from '@livelybone/vue-datepicker';
// or
import * as VueDatepicker from '@livelybone/vue-datepicker';

// Global register
Vue.component('datepicker', Datepicker);
Vue.component('timepicker', Timepicker);
Vue.component('datetime-picker', DatetimePicker);

// Local register
new Vue({
  components:{Datepicker, Timepicker, DatetimePicker}
})

Use in html, see what your can use in CDN: unpkg

在html中使用,查看可以在CDN中使用的内容:unpkg

<-- use what you want -->
<script src="https://unpkg.com/@livelybone/vue-datepicker/lib/umd/<--module-->.js"></script>

道具 (Props)

共同 (Common)

NameTypeDefaultValueDescription
id[String, Number]none
value[String, Number]none
placeholderStringnone
minStringnoneMin
maxStringnoneMax
canEditBooleantrueIf it can be changed
inputStyleObjectnoneStyle of input tag
popperPropsObjectdefaultPopperPropsProps of module @livelybone/vue-popper
scrollbarPropsObject{ isMobile: false, maxHeight: 200 }Props of scrollbar, see vue-scrollbar-live
名称 类型 默认值 描述
id [String, Number] 没有
value [String, Number] 没有
placeholder String 没有
min String 没有
max String 没有 最高
canEdit Boolean true 如果可以更改
inputStyle Object 没有 输入标签样式
popperProps Object defaultPopperProps 模块@ livelybone / vue-popper的道具
scrollbarProps Object { isMobile: false, maxHeight: 200 } 滚动条的属性,请参见vue-scrollbar-live
const defaultPopperProps = {
  arrowPosition: 'start',
  arrowOffsetScaling: 1,
  popperOptions: {
    placement: 'bottom-start',
    positionFixed: true,
    // more options in https://popper.js.org
  },
}

日期选择器 (Datepicker)

NameTypeDefaultValueDescription
dayStrArray['日', '一', '二', '三', '四', '五', '六']Used to set day name
名称 类型 默认值 描述
dayStr Array ['日', '一', '二', '三', '四', '五', '六'] 用于设置日期名称

时间选择器 (Timepicker)

NameTypeDefaultValueDescription
timeStrArray['时', '分', '秒']Used to set time name
btnStrString确定Used to set text of button
名称 类型 默认值 描述
timeStr Array ['时', '分', '秒'] 用于设置时间名称
btnStr String 确定 用于设置按钮的文字

日期时间选择器 (DatetimePicker)

NameTypeDefaultValueDescription
dayStrArray['日', '一', '二', '三', '四', '五', '六']Used to set day name
timeStrArray['时', '分', '秒']Used to set time name
btnStrString确定Used to set text of button
名称 类型 默认值 描述
dayStr Array ['日', '一', '二', '三', '四', '五', '六'] 用于设置日期名称
timeStr Array ['时', '分', '秒'] 用于设置时间名称
btnStr String 确定 用于设置按钮的文字

大事记 (Events)

NameEmittedDataDescription
inputString
名称 发射数据 描述
input String

样式 (style)

For building style, you can use the css or scss file in lib directory.

对于构建样式,可以使用lib目录中的css或scss文件。

// scss
import 'node_modules/@livelybone/vue-datepicker/lib/css/index.scss'

// css
import 'node_modules/@livelybone/vue-datepicker/lib/css/index.css'

Or

要么

// scss
@import 'node_modules/@livelybone/vue-datepicker/lib/css/index.scss';

// css
@import 'node_modules/@livelybone/vue-datepicker/lib/css/index.css';

Or, you can build your custom style by copying and editing index.scss

或者,您可以通过复制和编辑index.scss来构建自定义样式。

翻译自: https://vuejsexamples.com/a-vue-datepicker-component-chose-date-and-time/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值