原创 vue 使用路由重複跳轉同一頁面

重複跳轉的時候發送新的date this.$router.push(`/messages?date=${Date.now()}`).catch(() => {}); 頁面內監聽路由變化 ... watch: { $route

原创 Vue element-ui 限制時間範圍選擇

<el-date-picker type="datetimerange" v-model="datetime" :picker-options="pickerOptions" start-placeholder="開始日期" end-pla

原创 dayjs 使用筆記

全局配置 local 和 插件,通常在你的入口函數中調用 import dayjs from "dayjs"; import weekday from "dayjs/plugin/weekday"; import "dayjs/local

原创 TypeScript: 創建單例

在創建單例時,你可能會偷懶創建下面這樣的代碼 class A { static ins: A; arr = []; constructor() { return (A.ins ??= this); } } 上面的

原创 Uniapp: H5 壓縮圖片

uni.chooseImage... uni.getImageInfo({ src: res.tempFilePaths[0], success: (res) => { const blobUrl =

原创 android studio set proxy

假如你本地安裝了小飛機,那麼你可以這樣設置 proxy

原创 React Prompt組件 阻止用戶離開頁面

import { Prompt } from "react-router-dom"; const Login = () => { return ( <> <Prompt message={(loc

原创 c++ win32 遍歷進程列表

使用 CreateToolhelp32Snapshot #include <iostream> #include <Windows.h> #include <TlHelp32.h> #include <Psapi.h> int main

原创 JS 瀏覽器上生成 UUID API

console.log( window.crypto.randomUUID() ) See also: crypto.randomUUID()

原创 部署 Nestjs 最佳實踐

打包前配置 tsconfig.build.json 減少打包體積 { "extends": "./tsconfig.json", "compilerOptions": { "sourceMap": false, // 不

原创 Nginx 部署 單頁面應用 + nodejs api 應用 最佳實踐

假定你的域名是 xxx.com 如果沒有域名 則使用你的服務器 ip 現代前端框架打包後基本會將文件放在 /dist 目錄下,通常肯定會有一個index.html的文件 /dist/index.html 然後你需要把打包文件上傳到服務器,

原创 React JS: 如何使用 RxService 管理狀態

快速使用 vite 創建一個react-ts項目 λ npm init vite@latest npx: 6 安裝成功,用時 2.033 秒 √ Project name: ... myapp √ Select a framework: »

原创 umijs 開發優化和生產優化

.umirc.ts import { defineConfig } from 'umi'; import dev from './config/dev'; import prod from './config/prod'; consol

原创 vim 命令行 格式化文件縮進

格式化單文件 $ vim s.perl -c 'normal! gg=G' -c ':wq!' 多文件,手動退出 $ vim -c ':bufdo execute "normal! gg=G" | update' ./*

原创 Umijs use stylus

install stylus package $ npm i -D stylus [email protected] 我在使用時 webpack-chain 只支持webpack 2-4 所以不能下載webpack 5的 laoder