Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rmc-date-picker 为何在移动端刷新之后数据丢失了? #255

Open
lxc9314 opened this issue Dec 3, 2019 · 0 comments
Open

rmc-date-picker 为何在移动端刷新之后数据丢失了? #255

lxc9314 opened this issue Dec 3, 2019 · 0 comments

Comments

@lxc9314
Copy link

lxc9314 commented Dec 3, 2019

import React, { useState } from "react";
import "rmc-picker/assets/index.css";
import "rmc-date-picker/assets/index.css";
import DatePicker from "rmc-date-picker/lib/DatePicker";
import zhCn from "rmc-date-picker/lib/locale/zh_CN";
import enUs from "rmc-date-picker/lib/locale/en_US";
import { cn, format, minDate, maxDate, now } from "./utils";

const DatePick = props => {
const { locale } = props;
const [date, setDate] = useState(new Date(2017, 2, 31, 15, 1, 1));
const onDateChange = date => {
console.log("onChange", format(date));
setDate(date);
};
const onValueChange = (values, index) => {
console.log("onValueChange", values, index);
};
const onScrollChange = (values, index) => {
console.log("onScrollChange", values, index);
};
console.log(date);
return (
<DatePicker
rootNativeProps={{ "data-xx": "yy" }}
defaultDate={date || now}
mode="date"
locale={zhCn}
maxDate={maxDate}
minDate={minDate}
onDateChange={onDateChange}
onValueChange={onValueChange}
onScrollChange={onScrollChange}
>
);
};
DatePick.defaultProps = {
locale: cn ? zhCn : enUs
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant