lazy-portals-and-reload.go 927 B

123456789101112131415161718
  1. package advanced_functions
  2. import (
  3. "github.com/qor5/docs/docsrc/examples/e17_hello_lazy_portals_and_reload"
  4. "github.com/qor5/docs/docsrc/generated"
  5. "github.com/qor5/docs/docsrc/utils"
  6. . "github.com/theplant/docgo"
  7. "github.com/theplant/docgo/ch"
  8. )
  9. var LazyPortalsAndReload = Doc(
  10. Markdown(`
  11. Use ~web.Portal().EventFunc("menuItems").Name("menuContent")~ to put a portal place holder inside a part of html, and it will load specified event func's response body inside the place holder after the main page is rendered in a separate AJAX request. Later in an event func, you could also use ~r.ReloadPortals = []string{"menuContent"}~ to reload the portal.
  12. `),
  13. ch.Code(generated.LazyPortalsAndReloadSample).Language("go"),
  14. utils.Demo("Lazy Portals", e17_hello_lazy_portals_and_reload.LazyPortalsAndReloadPath, "e17_hello_lazy_portals_and_reload/page.go"),
  15. ).Title("Lazy Portals").
  16. Slug("vuetify-components/lazy-portals")