随笔分类 -  前端js

前端常用js基础
摘要:一.建立print.js,代码封装如下: export default function printHtml(html) { const style = getStyle() const container = getContainer(html) document.body.appendChild 阅读全文
posted @ 2022-03-22 14:39 雨季的泪 阅读(1825) 评论(0) 推荐(0) 编辑
摘要:function copyText(text){ var input = document.createElement('input'); input.setAttribute('id', 'input_for_copyText'); input.value = text; document.get 阅读全文
posted @ 2022-03-15 13:50 雨季的泪 阅读(997) 评论(0) 推荐(0) 编辑
摘要:格式化时间代码,未考虑格式和通用设计,只是最原始的样子 formatTime(time) { if (('' + time).length 10) { time = parseInt(time) * 1000 } else { time = +time } const d = new Date(ti 阅读全文
posted @ 2022-03-01 15:51 雨季的泪 阅读(97) 评论(0) 推荐(0) 编辑
摘要:js获取本周,本月,本季度,本年起止时间,直接上代码 timeSlotChange(val){ let startTime, endTime; let now = new Date(); //当前日期 var nowDayOfWeek = now.getDay(); //今天本周的第几天 var n 阅读全文
posted @ 2021-11-10 17:03 雨季的泪 阅读(869) 评论(0) 推荐(0) 编辑