日期组件
// ==UserScript==
// @name 日期组件
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.0
// @description try to take over the world!
// @author 张仨
// @match https://scriptcat.org/search
// @grant unsafeWindow
// @grant GM_addStyle
// @require https://cdn.jsdelivr.net/npm/zhangsan-layui@1.0.3/layui.js
// ==/UserScript==
let myapp = document.createElement("div");
document.body.appendChild(myapp);
myapp.id = "my-app";
myapp.innerHTML = `
<link rel="stylesheet" href="https://unpkg.com/layui@2.6.8/dist/css/layui.css">
<div class="layui-inline">
<input type="text" class="layui-input" id="test">
</div>`
layui.use('laydate', function () {
var laydate = layui.laydate;
laydate.render({
elem: '#test',
value: new Date(),
zIndex: 99999999,
theme: '#328dd1',
ready: function (date) {
console.log(date)
},
change: function (value, date, endDate) {
console.log(value, date, endDate)
},
done: function (value, date, endDate) {
console.log(value, date, endDate)
}
})
})
GM_addStyle(`
#my-app{
position: fixed;
top: 100px;
left: 30px;
width: 300px;
height: 300px;
border: 1px solid red;
padding: 20px 30px;
}
`)