U: 修改 windows xp 示例

This commit is contained in:
杨红岩 2024-01-04 22:58:39 +08:00
parent 2ba1dbab6c
commit 64f5d509da
4 changed files with 8 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"fmt"
"github.com/energye/energy/v2/cef"
"github.com/energye/energy/v2/examples/windows/windowsxp/test"
"github.com/energye/energy/v2/pkgs/assetserve"
)
@ -18,12 +19,12 @@ import (
以达到静态资源内嵌
*/
// 以下命令生成静态资源“字节数据”进行绑定,使用 go 命令: go generate
//go:generate energy bindata -fs -o=assets.go -pkg=assets ./assets
//go:generate energy bindata --fs --o=assets/assets.go --pkg=assets --paths=./resources
func main() {
fs := test.AssetFile()
//全局初始化 每个应用都必须调用的
cef.GlobalInit(nil, nil)
cef.GlobalInit(nil, fs)
//创建应用
app := cef.NewApplication()
//指定一个URL地址或本地html文件目录
@ -35,7 +36,7 @@ func main() {
server := assetserve.NewAssetsHttpServer()
server.PORT = 22022 //服务端口号
server.AssetsFSName = "resources" //必须设置目录名和资源文件夹同名
server.Assets = &resources
server.Assets = fs
go server.StartHttpServer()
})
//运行应用

1
go.mod
View File

@ -12,6 +12,7 @@ require (
atomicgo.dev/keyboard v0.2.9
github.com/godbus/dbus/v5 v5.1.0
github.com/jessevdk/go-flags v1.5.0
github.com/kenshaw/snaker v0.2.0 // indirect
github.com/lithammer/fuzzysearch v1.1.8
github.com/mattn/go-pointer v0.0.1
github.com/pterm/pterm v0.12.66

2
go.sum
View File

@ -39,6 +39,8 @@ github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/kenshaw/snaker v0.2.0 h1:DPlxCtAv9mw1wSsvIN1khUAPJUIbFJUckMIDWSQ7TC8=
github.com/kenshaw/snaker v0.2.0/go.mod h1:DNyRUqHMZ18/zioxr6R7m4kSxxf2+QmB0BXoORsXRaY=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=