
JavaScript
骑着蜗牛追星星呐
这个作者很懒,什么都没留下…
展开
-
svg写入/识别html元素和css样式
svg写入/识别html元素和css样式识别html的方法:使用foreignObject 元素嵌套html元素<foreignObject width="xxx" height="xxx" x="8" y="0"> <body xmlns="http://www.w3.org/1999/xhtml" class="svg-body"> <div class="break-word text-div text-align-center" style="font-wei原创 2021-11-19 18:19:32 · 392 阅读 · 0 评论 -
像excel一样规律填充(三)
三、日期值日期填充时应遵循一个原则:年 > 月 > 日/ 其他** 用到moment库// 获取日期的 从1970年1月1日0时0分0秒(UTC,即协调世界时)到该日期的毫秒数getDateValue(date) { let dateObject = moment(date); return dateObject.isValid() ? dateObject.valueOf() : 0; }// 计算年公差 calculateYearTolerance(da原创 2021-06-16 10:46:41 · 187 阅读 · 0 评论 -
像excel一样规律填充(二)
最普遍的填充就是没有规律的时候复制对应位置的内容,可以标记为:NORMAL_RULE = ({ value }) => {return value;};一、数字类型数字类型的填充可以归结为一点:最小二乘拟合。因此你需要知道什么是最小二乘拟合(https://baike.baidu.com/item/%E6%9C%80%E5%B0%8F%E4%BA%8C%E4%B9%98%E6%B3%95/2522346?fromtitle=%E6%9C%80%E5%B0%8F%E4%BA%8C%E4%B9.原创 2021-05-20 18:27:18 · 159 阅读 · 0 评论 -
计算旋转中心点坐标
记旋转角为β.α 和 β计算采用弧度制parseNumber作用:将数值浮点到8位小数const parseNumber = (num) => { return parseFloat(num.toFixed(8));};计算的核心利用外角进行计算if (!target || Object.keys(target).length !== 5) return {x: 0, y: 0};const { left, top, rotation, width, height .原创 2021-02-23 14:02:08 · 3906 阅读 · 0 评论 -
类似excel实现文本中带数字的值进行规律填充[前提:字符串中数字对数相等](-)
接收字符串列表, 返回填充规则 let textNumberMatrix = []; let RemainTextMatrix = []; textList.forEach(textString => { let newTextString = textString || ''; let Matrix = newTextString.match(/\d+/g) || []; textNumberMatrix.push(Matrix);原创 2020-06-11 11:46:54 · 256 阅读 · 0 评论