zpzpzp

Winform 使用 webview2 集成 React vite 项目

  •  
  •   zpzpzp · Feb 11, 2025 · 1231 views
    This topic created in 458 days ago, the information mentioned may be changed or developed.
    常见的使用前端 html,css 构建 windows 客户端有 electron 和 tauri ,微软官方的 winform Hybrid 使用的是.net core 版本的 winform 和 wpf ,且集成的是 Blazor ,这个项目使用 winform .netframwork 版本,然后通过 webview2 集成了 react 前端项目,react 使用 vite 打包,wpf 同理

    项目中只包含 winform 代码,需要手动在 bin/debug 目录里面创建一个文件夹,名字为 ReactBuild ,然后将 react 打包后的文件放进去就可以了 可以自己改 winform 代码更改路径

    同时因为使用 winform ,可以使用自带的 clickOnce 更新,解决了更新的问题

    多少有点剑走偏锋,适合这种情况:就是需要兼容 win7 ,需要访问 win32 Api ,团队成员后端语言是 C#,前端会点 react ,但是不想学习 xaml ,软件界面还想好看点,说的好像是我本人哈哈, 但是比 webview 封装一个网址来说少了后端服务器的资源占用,所以还是有点区别的。

    https://github.com/zpzpzp1024/WindowsFormsAppWithReact
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4240 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 262ms · UTC 10:12 · PVG 18:12 · LAX 03:12 · JFK 06:12
    ♥ Do have faith in what you're doing.