05 2022 档案
摘要:TypeScript重载函数的作用案例 C++中的一个概念(百度百科): 函数重载一般指重载函数。 重载函数是函数的一种特殊情况,为方便使用,C++允许在同一范围中声明几个功能类似的同名函数,但是这些同名函数的形式参数(指参数的个数、类型或者顺序)必须不同,也就是说用同一个函数完成不同的功能。这就是
阅读全文
摘要:TS中常用的工具映射类型,让写TS时效率大大提升,避免无意义的重复性定义。 1.Omit 省略/剔除 顾名思义 可以剔除 已定义对象中 自己不需要的一部分形成新的定义类型。 interface UserObj { readonly name: string; // readonly 只读属性 只能初
阅读全文
摘要:在使用ts的type 和 interface时 两者作用(简单案例) interface只能定义对象数据结构类型。 // 简单案例1 interface User { name: string; age: number; sex?: string; } let user: User = { name
阅读全文
摘要:js算法统计对象的层数 // 测试数据 var testObj = { b: { c: { d: { e: {} } }, c: { d: { e: { d: { a: { b: { a: { } }, a: { a: { a: { } } } } } } } } } } //封装方法 functi
阅读全文
摘要:效果对比图 普通table 标签 <table border="1"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> </table> 加了css限制的 <table> <tr
阅读全文
摘要:vue3+vite打包以后,项目切换路由触发(偶发触发)报: After using vue-router, there is an error in packaging and running # Failed to load module script: The server responded
阅读全文