WishMeLz

生活其实很有趣

Node/包 管理

锁定Node版本// package.json "engines":{ "node": "14.x || 16.xp" }// .npmrc engine-strict = true锁定包npm install -D only-allowonly-allow npm、only-allow pnpm、only-allow yarn// package.json "scripts": { "preinstall": "only-allow npm", ... }

storage封装

/*** * title: storage.js * Author: wish * Email: - * Time: 2022/7/25 21:32 * last: 2022/7/25 21:54 * Desc: 对存储的简单封装 */ import CryptoJS from 'crypto-js'; // 十六位十六进制数作为密钥 const SECRET_KEY = CryptoJS.enc.Utf8.parse("3333e6e143439161"); // 十六位十六进制数作为密钥偏移量 const SECRET_IV...

nodejs 掘金自动签到

const Koa = require('koa'); const schedule = require('node-schedule'); const _request = require('request'); const app = new Koa(); // https://api.juejin.cn/growth_api/v1/check_in? // 自定义 const sessionid = ''; // SessionID const url = ''; // Url const options = { ...

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...