webview 用 html 可直接编译跨平台 app

最后更新于:2022-04-02 02:38:51

[TOC] > [github](https://github.com/zserge/webview) ## demo 开发模式下可以按 快捷方式调出 控制台 ``` debug := true w := webview.New(debug) defer w.Destroy() w.SetTitle("Minimal webview example") w.SetSize(800, 600, webview.HintNone) //w.Navigate("https://www.baidu.com") w.Navigate(`data:text/html, hello )`) w.Init("alert('123')") w.Run() ``` ## 编译成 app ``` # Linux $ go build -o webview-example && ./webview-example # MacOS uses app bundles for GUI apps $ mkdir -p example.app/Contents/MacOS $ go build -o example.app/Contents/MacOS/example $ open example.app # Or click on the app in Finder # Windows requires special linker flags for GUI apps. # It's also recommended to use TDM-GCC-64 compiler for CGo. # http://tdm-gcc.tdragon.net/download $ go build -ldflags="-H windowsgui" -o webview-example.exe ```
';