WishMeLz

生活其实很有趣

Vue滑动验证

created() { const url = 'https://ssl.captcha.qq.com/TCaptcha.js' const script = document.createElement('script') script.type = 'text/javascript' script.src = url document.body.appendChild(script) script.onload = () => { console.log(window...

px2rem

npm i postcss-px2rempostcss.config.js module.exports = { plugins: { autoprefixer: { overrideBrowserslist: ['Android 4.1', 'iOS 7.1', 'Chrome > 31', 'ff > 31', 'ie >= 8'] }, "postcss-px2rem": { remUnit: 36, // 50px = 1rem remPrecision: 2 // ...

数字千分位

num = 12345.45678 num.toLocaleString('en-US',{minimumFractionDigits:5}) minimumFractionDigits:保留小数几位

html 导出 pdf

import html2canvas from "html2canvas" import JSPDF from "jspdf"封装 printPdf.js // 导出页面为PDF格式 import html2canvas from "html2canvas" import JSPDF from "jspdf" export default { // eslint-disable-next-line install (Vue, options) { Vue.prototype.ExportSavePdf = function (...

vue-print-nb 打印

npm i vue-print-nb import Print from 'vue-print-nb' use(Print) <a-button :style="{ marginLeft: '6px' }" v-print="'#printTest'">导出PDF</a-button> #printTest 是打印的容器 printSetting:{ id:"printTest", // 打印的容器ID popTitle:"得膜率图表", // 顶部标签 ...

echarts 悬浮框内容

tooltip 下 formatter: function (params) { console.log(params); var result = params[0].axisValue + "<br/>"; params.forEach(function (item) { var suffix = '' if(item.seriesName.indexOf('率') !=...

Vue2 动态插槽名称透传

<div class="tablesing"> <vxe-grid ref="xGrid" border show-overflow :data="dataSource" :columns="cloneColumns" height="700" :row-config="{ isHover: true, isCurrent: true,height:28 }" :column-config="{ isHover:...

ElementUi table合并

merageArr: any = [] // 每个列应该合并的rowspan index为列的序号 其value为需要合并的数值 merageIndex = 0 merge(){ // 避免筛选合并时出现错行 this.dataList = this.dataList.sort((a,b)=> a.rId-b.rId) // 遍历数组 通过一个key判断是否与上一项相同 // 结果类似于:[3,0,0,2,0] 第一个合并3行,剩下的两个为0...

Mac 虚拟机UTM

https://mac.getutm.app/ https://mac.getutm.app/support/Shift + F10 打开CMD 命令视窗(要同时按FN键,Shift + F10+ FN) OOBE\BYPASSNRO

JS修改input的value触发change事件

var inp = document.querySelector('input'); var ev = new Event('input', { bubbles: true }); ev.simulated = true; inp.value = 'new value' inp.dispatchEvent(ev);

JS生成字母A-Z

var arr = []; for(var i = 65; i < 91; i++){ arr.push(String.fromCharCode(i)); } return arr;

多级目录将数据递归成树状

let data = [ { id: 1, name: "电器", parentid: 0 }, { id: 2, name: "日用品", parentid: 0 }, { id: 3, name: "车用品", parentid: 0 }, { id: 4, name: "电饭煲", parentid: 1 }, { id: 5, name: "毛巾", parentid: 2 }, { id: 6, name: "雨刷器", parentid: 3 }, { id: 7, nam...

express 请求者IP

正常情况下:console.log(req.ip); // ::ffff:123.23.12.1使用nginx代理后: location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add...

随机图片API

https://s.file.itsse.cn/tool/api/v1/bg每次请求都是随机图片, 如下是预览图.图片包地址: https://www.aliyundrive.com/s/P7Ad98uXWRh