shortcut.go 845 B

123456789101112131415161718192021222324
  1. package basics
  2. import (
  3. "github.com/qor5/docs/docsrc/examples/e00_basics"
  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 ShortCut = Doc(
  10. Markdown(`
  11. To add keyboard shortcut to a button:
  12. Trigger the event by [GlobalEvents](https://www.npmjs.com/package/vue-global-events).
  13. You can configure your own keyboard event like ~@keyup.ctrl.enter~ to trigger the event.
  14. Also you can setup the ~filter~ function to limit when this event can be triggered by shortcut.
  15. In the example, the event would only be triggered when ~locals.shortCutEnabled~ is opened.
  16. `),
  17. ch.Code(generated.ShortCutSample).Language("go"),
  18. utils.Demo("Shortcut", e00_basics.ShortCutSamplePath, "e00_basics/shortcut.go"),
  19. ).Slug("basics/shortcut").Title("Keyboard Shortcut")