Fix: 时间最大最小限制不生效

Add: 可以指定渲染容器
pull/77/head
Maorey 2018-09-10 13:57:50 +08:00
parent bfc0c1bf6d
commit 27cc176162
5 changed files with 1110 additions and 1035 deletions

3
.gitignore vendored
View File

@ -18,3 +18,6 @@ node_modules/
_site/
release/
.npmignore
yarn*
*.log
*.lock

2
dist/laydate.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

51
test/index.html Normal file
View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>限制时间范围</title>
<script src="../src/laydate.js"></script>
</head>
<body>
<input id="start" placeholder="请选择日期" />
<div id="start_date"></div>
<input id="end" placeholder="请选择日期" />
<div id="end_date"></div>
<script>
function setAtts(obj, target) {
for (var key in target) {
obj[key] = target[key];
}
}
var start = laydate.render({
elem: '#start',
container: '#start_date',
type: 'time',
done: function (value, date) {
setAtts(end.config.min, date || {
hours: 0,
minutes: 0,
seconds: 0
});
}
});
var end = laydate.render({
elem: '#end',
container: '#end_date',
type: 'time',
done: function (value, date) {
setAtts(start.config.max, date || {
hours: 23,
minutes: 59,
seconds: 59
});
}
});
</script>
</body>
</html>