fix sui dynamic components import bug

This commit is contained in:
Max 2024-09-30 17:02:24 +08:00
parent dc162bb206
commit 369d6cc4d8
2 changed files with 9 additions and 0 deletions

View file

@ -284,6 +284,14 @@ func (page *Page) parseDynamics(ctx *BuildContext, sel *goquery.Selection) {
return
}
ctx.addJitComponent(route)
// This is a temprary solution, we will refactor this later
// Some components are not used in the page, but they are used in the script
// So we need to add them to the components
// But this solution is not perfect, it will cause import the unnecessary components, just ignore it.
// Add to the imports
name := fmt.Sprintf("comp_%s", strings.ReplaceAll(route, "/", "_"))
ctx.components[name] = route
})
}

View file

@ -901,6 +901,7 @@ func (parser *TemplateParser) show(sel *goquery.Selection) {
// sel.SetAttr("style", style)
}
// Tidy the template by removing the parsed attributes
func (parser *TemplateParser) Tidy(s *goquery.Selection) {
s.Contents().Each(func(i int, child *goquery.Selection) {