energy/example/browser-download/resources/资源存放目录-可内置到执行程序中.md
2022-11-24 18:44:03 +08:00

18 lines
708 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

可将html css javascript image等静态资源放入该目录编译后将内置到执行程序中
通过内置http server 读取该目录文件,展示到页面中
```go
//内置http服务链接安全配置
assetserve.AssetsServerHeaderKeyName = "energy"
assetserve.AssetsServerHeaderKeyValue = "energy"
//内置http服务链接安全配置
cef.SetBrowserProcessStartAfterCallback(func(b bool) {
fmt.Println("主进程启动 创建一个内置http服务")
//通过内置http服务加载资源
server := assetserve.NewAssetsHttpServer()
server.PORT = 22022
server.AssetsFSName = "resources" //必须设置目录名
server.Assets = &resources
go server.StartHttpServer()
})
```