234234234

随笔分类 -  JavaScript

前端必学之一
摘要:效果: const drawFlag = () => { const viewBox = 1024; const poleHeight = 1000; const poleWidth = 60; const poleX = 10; const poleY = 10; const x = poleX 阅读全文
posted @ 2023-12-18 11:47 你若愿意,我一定去 阅读(33) 评论(0) 推荐(0) 编辑
摘要:var target = {}; Object.prototype.toString.call(target).substring(8, 20).replace(']', '') 阅读全文
posted @ 2023-01-07 22:39 你若愿意,我一定去 阅读(18) 评论(0) 推荐(0) 编辑
摘要:const getTagFontSize = (tag: string): number => { const ele = document.createElement(tag); document.body.append(ele); const { fontSize } = getComputed 阅读全文
posted @ 2023-01-06 16:55 你若愿意,我一定去 阅读(615) 评论(0) 推荐(0) 编辑
摘要:<template> <h1>${COMPONENT_NAME}</h1> </template> <script lang="ts" setup> import {reactive} from 'vue'; import {useRouter} from "vue-router"; import 阅读全文
posted @ 2022-12-05 22:26 你若愿意,我一定去 阅读(700) 评论(0) 推荐(0) 编辑
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> .div { width: 100vw; height: 100vh; position: absolute; le 阅读全文
posted @ 2022-10-14 13:58 你若愿意,我一定去 阅读(198) 评论(0) 推荐(0) 编辑
摘要:<script> for (let i = -3; i < 4; i++) { // 用到了y = |x|函数的思想 const empty = Math.abs(i % 4); let row = ''; for (let j = 0; j < empty; j++) { row += ' '; 阅读全文
posted @ 2022-10-10 12:00 你若愿意,我一定去 阅读(63) 评论(0) 推荐(0) 编辑
摘要:export class Energy { public radius = 0; public pos = {x: 0, y: 0}; public cp = {x: 0, y: 0}; public speed = 1; public coefficient = {x: 0, y: 0}; pub 阅读全文
posted @ 2022-08-17 17:13 你若愿意,我一定去 阅读(25) 评论(0) 推荐(0) 编辑
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>驼峰、下划线互转</title> <style> * { margin: 0; padding: 0; } html. body { width: 100%; 阅读全文
posted @ 2022-07-11 13:38 你若愿意,我一定去 阅读(63) 评论(0) 推荐(0) 编辑
摘要:用jQuery在ie8中添加 $(ele).on('input propertychange') 不起作用, 是因为没有把input元素添加到document树上,本人测了好几次得到的结果。 阅读全文
posted @ 2022-04-25 11:27 你若愿意,我一定去 阅读(199) 评论(0) 推荐(0) 编辑
摘要:、、。。。。、 var compareBothObjKeys = function (obj1, obj2) { var diff = []; var obj1Diff = []; var obj2Diff = []; var bothDiff = []; // 两者都没有的 var keys1 = 阅读全文
posted @ 2022-03-23 17:17 你若愿意,我一定去 阅读(561) 评论(0) 推荐(0) 编辑
摘要:<script> var arr = [1,4,2,233,23,2,3,32,3,4,3,54,65,7,68,9,0]; function quickSort(arr) { // 边界条件 if (arr.length <= 1) { return arr; } // 获取中间下标及元素 con 阅读全文
posted @ 2022-01-11 16:17 你若愿意,我一定去 阅读(41) 评论(0) 推荐(0) 编辑
摘要:效果: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> html,body { width: 100%; height: 100%; } * { margin: 0 阅读全文
posted @ 2021-08-21 03:16 你若愿意,我一定去 阅读(46) 评论(0) 推荐(0) 编辑
摘要:一般是在图片加载完成之后再释放,就是用了之后再释放。 const blob = new Blob([res.data], {type: 'image/jpeg'}); src = window.URL.createObjectURL(blob) // 创建图片 window.URL.revokeOb 阅读全文
posted @ 2021-05-06 11:46 你若愿意,我一定去 阅读(1099) 评论(0) 推荐(0) 编辑
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>videoJs</title> </head> <body> <script type="text/javascript"> const originFile 阅读全文
posted @ 2020-12-15 22:37 你若愿意,我一定去 阅读(578) 评论(0) 推荐(0) 编辑
摘要:var canvas = document.getElementById('canvas');canvas.setAttribute('width', window.innerWidth);canvas.setAttribute('height', window.innerHeight); 阅读全文
posted @ 2020-08-23 20:02 你若愿意,我一定去 阅读(608) 评论(0) 推荐(0) 编辑
摘要:今天在修改之前一位老哥留下的bug,就是做一个计时器,然后自己做了一个,顺便记录一下。 代码: // this.paparTime 为时间戳,秒为单位 // this.countdownClock 把时间转成00:00:00 的时间字符串格式 const timeOclock = setInterv 阅读全文
posted @ 2020-07-30 18:01 你若愿意,我一定去 阅读(204) 评论(0) 推荐(0) 编辑
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Object.defineProperty</title> </head> <body> <script> class Test { constructor(d 阅读全文
posted @ 2020-07-25 15:45 你若愿意,我一定去 阅读(143) 评论(0) 推荐(0) 编辑
摘要:let arr = [2,4,5,7,91,3,5,7,4]; arr.sort() // 这样默认不会进行排序 实现排序需要自己定义规则: arr.sort((a, b) => {return a - b; }); // 升序,主要返回的是数字,不是Boolean值 阅读全文
posted @ 2020-05-29 09:19 你若愿意,我一定去 阅读(178) 评论(0) 推荐(0) 编辑
摘要:我的想法: 1.首先给移动的元素一个绝对定位,position: absolute, 通过top和left来实现元素的移动。 2. 基本过程:(1)当鼠标的左键按下去时,给元素添加onmousemove, onmouseleave(鼠标不在元素上时, 移除onmousemove事件), onmous 阅读全文
posted @ 2018-08-10 14:31 你若愿意,我一定去 阅读(162) 评论(0) 推荐(0) 编辑

23423423423
点击右上角即可分享
微信分享提示