cron-conversion-expression
v1.0.3
Published
cron表达式转换
Downloads
2
Readme
cron表达式转换
使用示例
import translation from 'xxxx.json'
import Cron from 'cron-conversion-expression'
import 'cron-conversion-expression/lib/index.min.css'
const [state, setState] = useState({});
<Cron
onChange={(e, text) => {
setState({ value: e });
console.log(e, text);
}} // change回调函数
value={state.value} // 组件的值
showResultText={true} // 是否展示转化的文本
showResultCron={true} // 是否展示Cron表达式
translateFn={(key) => translation[key]} // 国际化配置文件
/>
// translation.json
{
"Every": "每",
"day(s)": "天",
"Every week day": "每个工作日",
"Start time": "开始时间",
"hour": "小时",
"At": "在",
"minute(s)": "分钟",
"Day": "号",
"of every month(s)": "每月",
"Last day of every month": "每月的最后一天",
"On the last weekday of every month": "每个月的最后一天",
"before the end of the month": "每月最后",
"Monday": "星期一",
"Tuesday": "星期二",
"Wednesday": "星期三",
"Thursday": "星期四",
"Friday": "星期五",
"Saturday": "星期六",
"Sunday": "星期日",
"Minutes": "分钟",
"Hourly": "小时",
"Daily": "天",
"Weekly": "周",
"Monthly": "月",
"Custom": "自定义",
"Expression": "表达式"
}