在Vite+TypeScript的项目中使用~和@代替src根路径的方法

原由当前端项目组件比较多的时候引用组件会面临路径特别长的情况不易维护且容易出错。定义绝对路径映射是个好办法下面就介绍vitetypescript的项目中中的具体实现。方案​viteconfigts​resolve_{alias_{)}}​tsconfigjson​{_{_{]}}使用import{api_type_constants}fromimportmetaweblogmainfrom原来的import{api_type_constants}fromimportmetaweblogmainfrom
阅读更多

Next-js组件使用泛型类型传递异步数据

nextjs组件使用泛型类型传递异步数据定义类型typepageprops={hello_stringpage_anyrandom_any}返回属性https_githubcomvercelnextjsblobcanaryexamplescmswordpresspagesindexjsexportconstgetstaticprops_getstaticprops{constpageid=vtfmdmletpage=awaitgetpage(pageid)if(!page){page={}}return{
阅读更多