Fyne GUI编译为Web Assembly失败。

huangapple go评论126阅读模式
英文:

fyne GUI compile to Web Assembly failed

问题

我正在检查在浏览器中使用 Web Assembly 使用 Fyne 的可能性,但是我遇到了错误...
main.go:

  1. package main
  2. import (
  3. "fyne.io/fyne/v2/app"
  4. "fyne.io/fyne/v2/container"
  5. "fyne.io/fyne/v2/widget"
  6. )
  7. func main() {
  8. a := app.New()
  9. w := a.NewWindow("Hello")
  10. hello := widget.NewLabel("Hello Fyne!")
  11. w.SetContent(container.NewVBox(
  12. hello,
  13. widget.NewButton("Hi!", func() {
  14. hello.SetText("Welcome :)")
  15. }),
  16. ))
  17. w.ShowAndRun()
  18. }

我运行了这个命令,

  1. GOOS=js GOARCH=wasm go build -o main.wasm main.go

输出(错误):

  1. package command-line-arguments
  2. imports fyne.io/fyne/v2/app
  3. imports fyne.io/fyne/v2/internal/driver/glfw
  4. imports fyne.io/fyne/v2/internal/driver/common
  5. imports fyne.io/fyne/v2/internal/painter/gl
  6. imports github.com/go-gl/gl/v3.2-core/gl: build constraints exclude all Go files in /home/ahmed/go/pkg/mod/github.com/go-gl/gl@v0.0.0-20210813123233-e4099ee2221f/v3.2-core/gl
英文:

i was checking the possibility to use fyne in browser using Web Assembly , but i am getting error ...<br>
main.go :

  1. package main
  2. import (
  3. &quot;fyne.io/fyne/v2/app&quot;
  4. &quot;fyne.io/fyne/v2/container&quot;
  5. &quot;fyne.io/fyne/v2/widget&quot;
  6. )
  7. func main() {
  8. a := app.New()
  9. w := a.NewWindow(&quot;Hello&quot;)
  10. hello := widget.NewLabel(&quot;Hello Fyne!&quot;)
  11. w.SetContent(container.NewVBox(
  12. hello,
  13. widget.NewButton(&quot;Hi!&quot;, func() {
  14. hello.SetText(&quot;Welcome :)&quot;)
  15. }),
  16. ))
  17. w.ShowAndRun()
  18. }

i ran this command ,

  1. GOOS=js GOARCH=wasm go build -o main.wasm main.go

Output (error) :

  1. package command-line-arguments
  2. imports fyne.io/fyne/v2/app
  3. imports fyne.io/fyne/v2/internal/driver/glfw
  4. imports fyne.io/fyne/v2/internal/driver/common
  5. imports fyne.io/fyne/v2/internal/painter/gl
  6. imports github.com/go-gl/gl/v3.2-core/gl: build constraints exclude all Go files in /home/ahmed/go/pkg/mod/github.com/go-gl/gl@v0.0.0-20210813123233-e4099ee2221f/v3.2-core/gl

答案1

得分: 3

现在正在测试在浏览器中运行的功能。您可以使用Fyne的develop分支并安装该版本的fyne工具,然后运行:

$ fyne serve

它将通过端口:8080上的Web服务器加载您的Fyne应用程序。

英文:

The ability to run in a browser is now in testing. You can use the Fyne develop branch and install that version of the fyne tool, then run:

$ fyne serve

It will load your Fyne app via a web server on port :8080.

答案2

得分: 2

Fyne目前还不支持WebAssembly或通过浏览器进行交付。您可以观看我们上周在FyneConf上的技术预览视频,了解有关此工作的最新进展。
https://youtu.be/t8gEzPujIVI

英文:

Fyne does not yet support web assembly or delivering through a browser. You can watch our Tech Preview video from FyneConf last week to get an update on this work.
https://youtu.be/t8gEzPujIVI

huangapple
  • 本文由 发表于 2021年9月22日 00:47:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/69272636.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定