NutUI内网离线部署
- IT业界
- 2025-08-24 13:00:01

文章目录 官网拉取源代码到本地仓库修改源代码打包构建nginx反向代理部署访问内网离线地址
在网上找了一圈没有写NutUI内网离线部署的文档,花了1天时间研究下,终于解决了。 对于有在内网离线使用的小伙伴就可以参考使用了 如果还是不会联系UP主:QQ:1092705638
官网拉取源代码到本地仓库giteeNutUI的开源代码
修改源代码doc项目的index.vue文件 将这里的前缀全部改成跟我一样,它默认的不对
const watchDemoUrl = (router: RouteLocationNormalized) => { RefData.getInstance().currentRoute.value = router.path as string if (isTaro(router)) { data.demoUrl = `/uinut/demo.html/#/${ state ponentName.type }/pages/${state ponentName.name.toLowerCase()}/index` } else { if (router.path.includes('zh-CN')) { data.demoUrl = `/uinut/demo.html#/zh-CN/${state ponentName.name.toLowerCase()}` } else { data.demoUrl = `/uinut/demo.html#/en-US/${state ponentName.name.toLowerCase()}` } } } 打包构建下载下来会发现是双入口的项目,就是文档和demo是两个项目,文档项目嵌入了demo项目,也是费了好大劲解决的
vite.config.ts文件
会将两个项目打包到一个文件里如图,两个html文件的js和资源都在deemo-4.3.13里面
增加一个打包脚本
nginx反向代理部署nginx.conf配置
server { listen 2016; server_name localhost; #文档 location /docnut/ { alias "D:/soft/SoftProject/nutui/dist/h5/vue/4x/"; index index.html; try_files $uri $uri/ /nutdoc/index.html; } #demo location /uinut/ { alias "D:/soft/SoftProject/nutui/dist/h5/vue/4x/"; index demo.html; try_files $uri $uri/ /uinut/demo.html; } 访问内网离线地址你的IP:端口/docnut/index.html
NutUI内网离线部署由讯客互联IT业界栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“NutUI内网离线部署”