随笔分类 - 前端js
前端常用js基础
摘要:一.建立print.js,代码封装如下: export default function printHtml(html) { const style = getStyle() const container = getContainer(html) document.body.appendChild
阅读全文
摘要:function copyText(text){ var input = document.createElement('input'); input.setAttribute('id', 'input_for_copyText'); input.value = text; document.get
阅读全文
摘要:格式化时间代码,未考虑格式和通用设计,只是最原始的样子 formatTime(time) { if (('' + time).length 10) { time = parseInt(time) * 1000 } else { time = +time } const d = new Date(ti
阅读全文
摘要:js获取本周,本月,本季度,本年起止时间,直接上代码 timeSlotChange(val){ let startTime, endTime; let now = new Date(); //当前日期 var nowDayOfWeek = now.getDay(); //今天本周的第几天 var n
阅读全文