css配置全局滚动条样式
css 配置全局滚动条样式::-webkit-scrollbar { /*滚动条整体样式*/ width: 5px; /*高宽分别对应横竖滚动条的尺寸*/ height: 6px;}::-webkit-scrollbar-thumb { /*滚动条里面小方块*/ box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); background: #000; // 替换你想要的颜色 border-radius: 6px;}::-webkit-scrollbar-track { /*滚动条里面轨道*/ border-radius: 10px; background: unset;}::-webkit-scrollbar-corner { background-color: transparent;}
这个是全局的样式 如果单独的元素只需要写在需要设置的类名下就可以了
proj4 WGS84、UTM坐标系的互相转换
废话不多说 直接上代码
// 1. 获取 UTM带号、CRSCODEgetUTMCRSCode(latitude, longitude) { // 计算UTM带号 let zoneNumber = Math.floor((longitude + 180) / 6) + 1; // 确定半球 let hemisphere = latitude >= 0 ? '326' : '327'; // 生成UTM CRS代码 let utmCRSCode = `EPSG:${hemisphere}${String(zoneNumber).padStart(2, '0')}`; return { zoneNumber, utmCRSCode };}/** * 2. WGS84 TO UTM * @param latitude 基准点坐标lat * @param longitude 基准点坐标lng * @pa ...
js 实现 copy 字符串 复制到剪切板
js 实现 copy 字符串 复制到剪切板
定义方法
function copyStr(str) { var oInput = document.createElement('input'); oInput.value = str; document.body.appendChild(oInput); oInput.select(); // 选择对象 document.execCommand('Copy'); // 执行浏览器复制命令 oInput.className = 'oInput'; oInput.style.display = 'none';}
调用方法
copyStr('要copy的内容');
微信小程序css实现瀑布流布局
废话不多说 直接上代码
.list { column-count: 2; column-gap: 24rpx;}.list .item { display: block; page-break-inside: avoid; // 解决出现内容分割的情况}
humps 下划线分割字符串转驼峰不仅可以转换字符串还能转换对象键
humps 下划线分割字符串转驼峰
安装
yarn add humps -D// ornpm i humps -D
使用
// 引入const humps = require('humps');
转换字符串
// 下划线转驼峰humps.camelize('hello_world'); // 'helloWorld'// 驼峰转下划线humps.decamelize('fooBar'); // 'foo_bar'// 特定分隔符分割humps.decamelize('fooBarBaz', { separator: '-' }); // 'foo-bar-baz'
转换对象键
var object = { attr_one: 'foo', attr_two: 'bar' };humps.camelizeKeys(object); ...