28 lines
393 B
Go
28 lines
393 B
Go
//go:build embed
|
|
// +build embed
|
|
|
|
package web
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"net/http"
|
|
)
|
|
|
|
//go:embed dist/*
|
|
var distFS embed.FS
|
|
|
|
// GetFileSystem 返回嵌入的前端文件系统
|
|
func GetFileSystem() http.FileSystem {
|
|
sub, err := fs.Sub(distFS, "dist")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return http.FS(sub)
|
|
}
|
|
|
|
// IsEmbedded 返回前端是否已嵌入
|
|
func IsEmbedded() bool {
|
|
return true
|
|
}
|