1.0.3 • Published 2 years ago

@dsh-prose/date-picker v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

移动端日期选择器

使用

import React, { useEffect, useRef } from "react";
import DatePicker from "@dsh-prose/date-picker";

function App(): JSX.Element {
  const dp = useRef<DatePicker | null>(null);
  useEffect(() => {
    dp.current = new DatePicker({
      allowMaskClose: false,
      // initDate: "2018-10-5",
      minDate: "2019-9-25",
      maxDate: "2021-11-25",
      onConfirm: (date) => {
        console.log("date", date);
      },
    });
  }, []);

  return (
    <>
      <button
        style={{
          display: "block",
          fontSize: 30,
          width: "80%",
          height: 44,
          margin: "10px auto",
        }}
        onClick={() => {
          dp.current?.trigger();
        }}
      >
        日期选择
      </button>
    </>
  );
}

export default App;

参数

参数说明默认值类型必选
split分隔符-string×
allowMaskClose允许点击蒙层关闭trueboolean×
minDate最小日期2000-01-01string×
maxDate最大日期当年当月当天string×
initDate初始化日期string×
onConfirm选择时间(date: string | null) => void;×

返回值

参数说明默认值类型必选
trigger显示切换()=> void;×
setCurrentDate设置当前时间(date: string)=> void;×
getCurrentDate获取当前时间()=> string | null;×
destroy销毁 DOM 与事件() => void;×
1.0.2

2 years ago

1.0.0

2 years ago

1.0.3

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.2-alpha.3

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago