英文:
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 (
"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()
}
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论