Fyne GUI编译为Web Assembly失败。

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

fyne GUI compile to Web Assembly failed

问题

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

package main

import (
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Hello")

	hello := widget.NewLabel("Hello Fyne!")
	w.SetContent(container.NewVBox(
		hello,
		widget.NewButton("Hi!", func() {
			hello.SetText("Welcome :)")
		}),
	))

	w.ShowAndRun()
}

我运行了这个命令,

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

输出(错误):

package command-line-arguments
	imports fyne.io/fyne/v2/app
	imports fyne.io/fyne/v2/internal/driver/glfw
	imports fyne.io/fyne/v2/internal/driver/common
	imports fyne.io/fyne/v2/internal/painter/gl
	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 :

package main

import (
	&quot;fyne.io/fyne/v2/app&quot;
	&quot;fyne.io/fyne/v2/container&quot;
	&quot;fyne.io/fyne/v2/widget&quot;
)

func main() {
	a := app.New()
	w := a.NewWindow(&quot;Hello&quot;)

	hello := widget.NewLabel(&quot;Hello Fyne!&quot;)
	w.SetContent(container.NewVBox(
		hello,
		widget.NewButton(&quot;Hi!&quot;, func() {
			hello.SetText(&quot;Welcome :)&quot;)
		}),
	))

	w.ShowAndRun()
}

i ran this command ,

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

Output (error) :

package command-line-arguments
	imports fyne.io/fyne/v2/app
	imports fyne.io/fyne/v2/internal/driver/glfw
	imports fyne.io/fyne/v2/internal/driver/common
	imports fyne.io/fyne/v2/internal/painter/gl
	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:

确定