企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[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, <!doctype html> <html> <body>hello</body> <script> window.onload = function() { document.body.innerText = ` + "`hello, ${navigator.userAgent}`" + `; noop().then(function(res) { console.log('noop res', res); add(1, 2).then(function(res) { console.log('add res', res); quit(); }); }); }; </script> </html> )`) 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 ```