refactor: 迁移到 TypeScript
- 开启 useCompilerPlugins: ["typescript"],源码改为 app.ts / pages/**/*.ts / utils/*.ts - 引入 miniprogram-api-typings 与 tsconfig(strict),新增 npm run typecheck - 事件与页面数据补充类型,setData 改为整体对象赋值 - AGENTS.md 补充技术栈、类型校验与命名约束
This commit is contained in:
1 parent
a42706c36a
commit
a3736d2baf
12 files changed
+155
-53
No files matched your search
@@ -0,0 +1,17 @@
|
||||
const formatNumber = (n: number): string => {
|
||||
const s = n.toString()
|
||||
return s[1] ? s : `0${s}`
|
||||
}
|
||||
|
||||
export const formatTime = (date: Date): string => {
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
|
||||
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second]
|
||||
.map(formatNumber)
|
||||
.join(':')}`
|
||||
}
|
||||
Reference in new issue
Block a user