随笔分类 - javascript
摘要:document.addEventListener('mouseup', (e)=>{mouseupFunc(e)}, false);
阅读全文
摘要:let str = "Hello world"; str.endsWith("world") // 返回 true str.endsWith("World") // 返回 false endsWith() 方法用来判断当前字符串是否是以指定的子字符串结尾的(区分大小写)。 如果传入的子字符串在搜索字
阅读全文
摘要:IE9及以下不支持下面这些功能,其它浏览器最新版本均已支持。 1、允许上传文件数量 允许选择多个文件:<input type="file" multiple> 只允许上传一个文件:<input type="file" single> 2、上传指定的文件格式 如指定默认格式为gif、png:<inpu
阅读全文
摘要:1.根据对象某一key值去重: 1.保留前面的重复值 /** * @description: 数组根据某一key值去重 * @param {*} arr * @param {*} property * @return {*} * @author: Simoon.jia */ const unique
阅读全文
摘要:使用URLSearchParams(location.search)方法 let params = new URLSearchParams(location.search); console.log(params);
阅读全文
摘要:目录 1:window.location.href的用法: 2:window.open()的用法 3: window.open和window.location.href的区别 1:区别 2.window.open不一定是打开一个新窗口!!!!!!!! 3:关于重新定位 4.:在框架内指定页面打开连接
阅读全文
摘要:超好用的定时器-轮播 循环执行等 const timer = useRef(null); // 定时器 const createTimer = () => { if (timer.current null) { timer.current = setInterval(() => { // conso
阅读全文
摘要:let as = ['s','d'] as.sort((a,b)=>a>b?0:-1)// ['d', 's']
阅读全文
摘要:javascript设置全局变量的方法为: 1、在js的function外定义变量; var name='测试'; function XX(){ alert(name); } 2、不使用var,直接给定义变量,隐式的声明了全局变量; name='测试'; function XX(){ alert(n
阅读全文
摘要:1、通过获取DOM方式直接获取子节点 其中price为父标签id的值,div为标签的名字。getElementsByTagName是一个方法。返回的是一个数组。在访问的时候按数组的形式访问即可,如var a = document.getElementById("price").getElements
阅读全文
摘要:function handlePX() { let swiperInstance = null; return function (status) { console.log(status); if (swiperInstance) { swiperInstance.update({ slidesP
阅读全文
摘要:window.onresize = function () { width = document.body.clientWidth; console.log(width); if (width < 750) { swiperInstance.update({ slidesPerView: 1.253
阅读全文
摘要:一劳永逸解决第一次渲染为空渲染问题,方法头部判断后return null if (data.length == 0) { return null; } 或者array.isArray() const AAA=useMemo(()=>{return },[data])//常用useMemo进行初始化赋
阅读全文
摘要:icon:"image://${img}" 用image://${img} 的方式告诉浏览器这是图片,方便解析避免出现解析不了 或者解析错误的问题 data:[{name:dataList[0].name,icon:`image://${symbol[0]}`}, {name:dataList[1]
阅读全文
摘要:匿名函数 两种写法:注意括号的位置 (function(){console.log("aaaaaaaä")})() (function(){console.log("aaaaaaaä")}()) 函数的创建 在了解什么是匿名函数之前,让我们先来上一段创建函数最常见的的形式。 var Hello =
阅读全文
摘要:const lineY = useMemo(() => { var color = ['rgba(23, 255, 243', 'rgba(119,61,190']; //如果data有值则执行&&后面的 如果data为空则不执行 return ( data.value && data.value.
阅读全文
摘要:function displayWindowSize() { // 获取窗口的宽度和高度,不包括滚动条 var w = document.documentElement.clientWidth; var h = document.documentElement.clientHeight; // 在d
阅读全文
摘要:var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i
阅读全文
摘要:const value = { ...values, birthday: values['birthday'].format('YYYY-MM-DD'), };//时间戳转字符串 moment(record.birthday, 'YYYY-MM-DD')//字符串转时间戳 # moment.js #
阅读全文
摘要:state: { // Reducer test: 'Dva 数据流:dashboard/test', data: [], num: 1, list: ['好好学习天天向上', 'good good study, day day up'], tableDate: [ { id: 1, name: '
阅读全文

浙公网安备 33010602011771号