-
Next.js App Router 设置统一错误页面
error 页面 src/app目录下新建error.tsx。 且代码第一行必须指定'use client',否则会认定为服务端error接口。 代码 'use client' export de
2025-10-17, Views: 204 , Topics: Next.js
-
Next.js App Router 设置统一 404 页面
404 页面 src/app目录下新建not-found.tsx文件。 名称必须是not-found,后缀可以是jsx、tsx等。 代码 not-found.tsx文件内容 export defau
2025-10-16, Views: 202 , Topics: Next.js
-
Next.js 跳转到 not-found.tsx 和 error.tsx 定义的页面
not-found 跳转到not-found.tsx定义的页面。 使用notFound()方法即可。无需return。 import {notFound} from "next/navigation
2025-10-15, Views: 233 , Topics: Next.js
-
Node.js Drizzle PostgreSQL 数组类型
array() text().array()表示text[]。 import {integer, pgTable, text} from "drizzle-orm/pg-core"; const
-
Node.js Drizzle PostgreSQL timestamptz 带时区的时间戳类型
timestamp() timestamp({withTimezone: true}),传入withTimezone属性为true。 import {integer, pgTable, timest
-
Node.js Drizzle PostgreSQL bigserial 类型
bigserial() bigserial("record_page_view_id_seq", {mode: "bigint"}),第一个参数指定序列的名称,第二个参数传入mode属性,指定big
-
Node.js Drizzle PostgreSQL bigint 类型
bigint() bigint({mode: "bigint"}),传入mode属性,指定bigint或number import { bigint, pgTable, timestamp } fr
-
Node.js Drizzle orderBy 升序、降序、联合排序
orderBy() 使用typeof、$inferSelect提取表结构的类型。 升序 orderBy(columnName)等价于orderBy(asc(columnName)) const po
-
Node.js Drizzle 查询表结构返回的类型
$inferSelect 使用typeof、$inferSelect提取表结构的类型。 const posts = pgTable("post", { id: integer().prima
-
TypeScript Omit Pick Partial 的用法
Omit Omit<原类型, 要删除的键>,使用|选择多个键 interface User { name: string, age: number, password: st
2025-10-08, Views: 229 , Topics: TypeScript
-
TypeScript Record 特性
说明 类似于JavaScript中的Map。 与Map不同的是: Record遍历时先输出数字类型的字段,再输出字符类型的字段 Map遍历时按放入时的顺序输出。 Record<string, M
2025-10-07, Views: 259 , Topics: TypeScript
-
TypeScript 配置 script 脚本 CrossOrigin 从 .env 文件读取时报 TS2322 类型不匹配
原因 .env文件中配置的变量默认是string字符串类型。 TypeScript中script脚本标签中的CrossOrigin属性允许的值是anonymous、use-credentials、"
2025-10-06, Views: 243 , Topics: TypeScript 跨域
-
Vite 中编辑 vite.conf.ts process 报错
process 报错 原因:没有安装@types/node类型提示。 npm install @types/node -D 参考文档 https://vite.dev/config/
-
PostgreSQL 按月统计数据
需求 统计从年初到当前月的每月数据。 如果是历年数据则完整统计1-12月,如果是今年数据则统计1到当前月(如:1-10月)。 generate_series 使用PostgreSQL的内置方法gen
2025-10-04, Views: 271 , Topics: PostgreSQL
-
CSS 使用 flex-shrink 0 解决 flex 1 布局中元素设置的高度不生效问题
现象 代码 .container { flex: 1; overflow-y: scroll; } 原因 flex: 1依赖容器高度,没有容器高度,flex: 1会无限拉伸,把元素
2025-10-03, Views: 283 , Topics: CSS
-
Tailwind CSS 在微信开发者工具中不生效问题
现象 前端使用了Tailwind4开发网页应用H5,在原生浏览器和手机浏览器都生效,但是在微信开发者工具中,Tailwind的样式都不生效。 原因 Tailwind CSS默认使用了CSS的@lay
-
Linux watch + PostgreSQL 一行命令实现数据每秒实时监控
相关命令 Linux中的watch PostgreSQL的psql 命令 watch -n指定间隔执行命令的秒数。 psql -U指定使用哪个数据库的用户。 psql -d指定连接哪个数据库。
2025-10-01, Views: 345 , Topics: PostgreSQL Linux psql
-
Spring Boot Jackson 创建 JsonNode 对象
代码 使用ObjectMapper的createObjectNode方法创建对象类型JsonNode,使用createArrayNode方法创建数组类型JsonNode。 ObjectMapper
2025-09-30, Views: 354 , Topics: Jackson Spring Boot
-
Spring Boot Jackson No serializer found for class
Spring Boot Jackson No serializer found for class 错误信息 No serializer found for class xxx and no pr
2025-09-29, Views: 295 , Topics: Jackson Spring Boot
-
Spring Boot MyBatis-Plus setSql() 方法用法
自定义 SQL 片段 setSql(String setSql, Object... params) boolean success = pointsService.lambdaUpdate()
2025-09-28, Views: 295 , Topics: MyBatis-Plus Spring Boot