700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > go语言用html桌面 使用go语言和webview编写桌面应用

go语言用html桌面 使用go语言和webview编写桌面应用

时间:2021-04-12 00:45:12

相关推荐

go语言用html桌面 使用go语言和webview编写桌面应用

/tenny1225/go-web-app

具体思路是使用http实现页面跳转,使用jsonrpc实现ui和go之间的数据通讯。

golang版本的webview使用的是/zserge/webview这个库,自己封装了一套Page,实现页面之间的跳转。具体使用

package main

import "time"

func main() {

StartWindow("golang html", 400, 400, true, func() {

pager := NewPager(&MyPage{},&MyPageAction{})

pager.StartPage(0)

})

}

type MyPage struct {

PageImpl

}

type MyPage1 struct {

PageImpl

}

type MyPageAction struct {

P *MyPage

i int

}

func (t *MyPageAction) Add(i int,s *string) error {

pager := NewPager(&MyPage1{},nil)

pager.StartPage(0)

*s = "success"

return nil

}

func (p *MyPage) Stop() {

}

func (p*MyPage)Start() {

p.SetContentView("html/page1.html")

}

func (p *MyPage1) Stop() {

}

func (p*MyPage1)Start() {

p.SetContentView("html/page2.html")

go func() {

time.Sleep(5*time.Second)

p.Window.Backup()

}()

}

这里默认打开第一个页面,点击按钮跳转到第二个页面,五秒钟后页面返回。

-11-29 17-38-04屏幕截图.png

-11-29 17-38-22屏幕截图.png

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。