WishMeLz

生活其实很有趣

Wish 发布的文章

decimal.js 加减乘除

import Decimal from 'decimal.js'; // 加法 function add(...nums: number[]): number { return nums.reduce((total, num) => new Decimal(total).plus(num), 0).toNumber(); } // 减法 function subtract(...nums: number[]): number { return nums.reduce((total, num) => new Decimal(t...

uniapp 二维码

<canvas canvas-id="Qrcode"></canvas> qrCode.api.draw(text, { ctx: uni.createCanvasContext('Qrcode'), width: 127, height: 127 });https://github.com/WishMelz/file/blob/master/js/qrCode.js

Flex 布局

https://github.com/lecepin/code-lab/tree/main/flex%20%E5%A4%87%E5%BF%98%E5%BD%95

表格拖拽Elementui+sortablejs

import Sortable from 'sortablejs'; columnDrop() { let _this = this const wrapperTr = document.querySelector('.draggable .el-table__header-wrapper tr') this.sortable = Sortable.create(wrapperTr, { animation: 180, delay: 0, onEnd: (evt: any) ...

Vue 动态引入路由文件

const routerList = [] const routerUrls = require.context('./router', true, /\.js/) console.log(routerUrls); routerUrls.keys().forEach(item=>{ routerList.push(...routerUrls(item).default) })

Docker-compose

wget https://github.com/docker/compose/releases/download/1.23.0-rc3/docker-compose-Linux-x86_64 mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose docker-compose --versioncurl -L https://github.com/docker/compose/releases/dow...

WebStorm

版本: 2022.2.2 生成: 222.4167.31 2022年9月15日https://github.com/WishMelz/file/blob/master/2022/2022-jetbrains.zip进入 IDEA 的安装目录进入 /bin 目录下,修改 idea64.exe.vmoptions 配置文件:修改配置文件# 引用补丁,开头必须以 -javaagent: 开头,后面跟着补丁的绝对路径(可根据你实际的位置进行修改),注意路径一定要填写正确,且不能包含中文,否则会导致 webstorm 无法启动 -javaag...

Vue JSX/TSX $attrs用法

<el-table data={this.data} height={this.height} {...{ props: this.$attrs, on: this.$listeners, }} ></el-table>

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:保留小数几位