From 0d93101653200c276b4ca3f188d0b648d57b62ce Mon Sep 17 00:00:00 2001 From: bergyu Date: Tue, 4 Jan 2022 16:03:09 +0800 Subject: [PATCH] opt app --- misc/app/app.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/misc/app/app.go b/misc/app/app.go index 4ef23e3f..2174698d 100644 --- a/misc/app/app.go +++ b/misc/app/app.go @@ -3,29 +3,31 @@ package app import ( "github.com/webview/webview" "shylinux.com/x/ice" + kit "shylinux.com/x/toolkits" ) -var ww *webview.WebView - type app struct { title string `name:"title text" help:"标题"` list string `name:"list auto title" help:"应用"` } func (app app) Title(m *ice.Message, arg ...string) { - (*w).SetTitle("contexts") + (*ww).SetTitle("contexts") } func (app app) List(m *ice.Message, arg ...string) { } func init() { ice.Cmd("web.chat.app", app{}) } -func Run() { + +var ww *webview.WebView + +func Run(arg ...string) { w := webview.New(true) defer w.Destroy() ww = &w - w.SetTitle("contexts") w.SetSize(800, 600, webview.HintNone) - w.Navigate("http://localhost:9020") + w.SetTitle(kit.Select("contexts", arg, 0)) + w.Navigate(kit.Select("http://localhost:9020", arg, 1)) w.Run() }