naive-ui/demo/documentation/components/log/enUS/index.demo-entry.md
07akioni 487001d697 build: add changelog to site, refactor loader based on suffix
.demo.md for component demo
.demo-entry.md for demo entry
.md for common docs
2020-08-19 23:30:04 +08:00

1.5 KiB

Log

If you have some logs to show, use log.

Due to package size, Naive UI doesn't include highlight.js. If you want highlight logs, make sure you have set highlightjs before using it.

In hightlight demo, we defined a language called naive-log which will highlight all the numbers of line. The following code shows how we defined it. If you want to know more about hightlight.js, see hightlight.js and highlight.js developer documentation

...
hljs.registerLanguage('naive-log', () => ({
  contains: [
    {
      className: 'number',
      begin: /\d+/
    }
  ]
}))

Vue.use(NaiveUI)
NaiveUI.setHljs(hljs)
...

Demos

size
event
scroll
highlight
loading

Props

Name Type Default Description
theme 'light' | 'dark' | null null
loading boolean false
trim boolean false
log string null
lines Array<string> null
font-size number 14
line-height number 1.25
language string null
rows number 15
hljs Object null

Events

Name Parameters Description
require-more (from: 'top' | 'bottom')
reach-top ()
reach-bottom ()

Methods

Name Parameters Description
scrollToTop (dismissEvent: boolean = false)
scrollToBottom (dismissEvent: boolean = false)