naive-ui/demo/documentation/components/log/enUS/index.md

32 lines
832 B
Markdown
Raw Normal View History

2019-12-13 22:35:03 +08:00
# Log
2019-12-16 19:00:34 +08:00
<!--single-column-->
<n-alert title="Note" type="warning">
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.
</n-alert>
2019-12-22 16:10:18 +08:00
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 <n-a href="https://highlightjs.org/">hightlight.js</n-a> and <n-a href="https://highlightjs.readthedocs.io/en/latest/index.html">highlight.js developer documentation</n-a>
```js
...
hljs.registerLanguage('naive-log', () => ({
contains: [
{
className: 'number',
begin: /\d+/
}
]
}))
Vue.use(NaiveUI)
NaiveUI.setHljs(hljs)
...
```
## Demos
2019-12-13 22:35:03 +08:00
```demo
size
event
2019-12-18 18:07:31 +08:00
scroll
highlight
2019-12-17 18:14:02 +08:00
loading
2019-12-13 22:35:03 +08:00
```