欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 房产 > 家装 > 【go】仅设想,能不能通过pure go编写页面。

【go】仅设想,能不能通过pure go编写页面。

2024/10/23 21:36:27 来源:https://blog.csdn.net/2301_76933862/article/details/143164333  浏览:    关键词:【go】仅设想,能不能通过pure go编写页面。

设想

通过pure-go编写页面, 似乎不太好实现, 就当学习前端html基础了。
完成度 0.5%
App.go:

package srcimport (d "github.com/go-webtools/wgo/core/document""github.com/go-webtools/wgo/core/react""github.com/go-webtools/wgo/core/window"
)func App() d.Html {state, setState := react.UseState("Hello")handleClick := func() {window.Alert("Clicked")setState("world")}return d.Html{Child: []d.Element{d.H1{Child: "Hello World"}, // 添加一个 H1 元素d.Div{Child: []d.Child{"Nested Child And State is:", // 字符串作为子元素state,d.H1{Child: "Nested H1"}, // 嵌套一个 H1d.Button{Child:   "按钮",OnClick: handleClick,},}},},}
}

wgo

编写一个wgo。
wgo run 等价于 yarn serve, 开发模式的页面,加载html到内存
wgo build 等价于yarn build, 构建html到dist/目录下。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com