feat(themes): add loading info

This commit is contained in:
qingwei.li
2017-02-19 08:39:05 +08:00
committed by cinwell.li
parent a6d823b826
commit 86594a3118
5 changed files with 64 additions and 2 deletions

View File

@@ -65,7 +65,7 @@ The hook supports handling asynchronous tasks.
```js
window.$docsify = {
plugins: [
function (hook) {
function (hook, vm) {
hook.init(function() {
// Called when the script starts running, only trigger once, no arguments,
})

View File

@@ -61,3 +61,25 @@ If your system has Python, you can easily to run a static server to preview your
```bash
cd docs && python -m SimpleHTTPServer 3000
```
## Loading tip
Show `Loading...` Before starting rendering. You can customize the content.
*index.html*
```html
<div id="app">Please wait...</div>
```
You should set the `data-app` attribute if you changed `el`.
*index.html*
```html
<div data-app id="main">Please wait...</div>
<script>
window.$docsify = {
el: '#main'
}
</script>
```

View File

@@ -61,7 +61,7 @@ docsify 提供了一套插件机制其中提供的钩子hook支持处
```js
window.$docsify = {
plugins: [
function (hook) {
function (hook, vm) {
hook.init(function() {
// 初始化时调用,只调用一次,没有参数。
})

View File

@@ -59,3 +59,26 @@ docsify serve docs
```bash
cd docs && python -m SimpleHTTPServer 3000
```
## Loading 提示
初始化时会显示 `Loading...` 内容,你可以自定义提示信息。
*index.html*
```html
<div id="app">加载中</div>
```
如果更改了 `el` 的配置,需要将该元素加上 `data-app` 属性。
*index.html*
```html
<div data-app id="main">加载中</div>
<script>
window.$docsify = {
el: '#main'
}
</script>
```

View File

@@ -7,6 +7,23 @@
-webkit-font-smoothing: antialiased;
}
body:not(.ready) {
[data-cloak] {
display: none;
}
}
div#app {
text-align: center;
font-size: 30px;
font-weight: lighter;
margin: 40vw auto;
&:empty::before {
content: "Loading...";
}
}
.emoji {
height: 1.2em;
vertical-align: middle;