Skip to content

Commit 0b7485d

Browse files
authored
Update docs for 4.12.0 (#31)
1 parent 8db3d39 commit 0b7485d

File tree

4 files changed

+452
-60
lines changed

4 files changed

+452
-60
lines changed

configuration.md

+114-1
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,18 @@ window.$docsify = {
464464
};
465465
```
466466

467+
## crossOriginLinks
468+
469+
- type: `Array`
470+
471+
当设置了`routerMode:'history'`时,你可能会面临跨域的问题,参见 [#1379](https://github.com/docsifyjs/docsify/issues/1379) 。在 Markdown 内容中,有一个简单的方法可以解决,参见[helpers](zh-cn/helpers.md) 中的跨域链接。
472+
473+
```js
474+
window.$docsify = {
475+
crossOriginLinks: ['https://example.com/cross-origin-link'],
476+
};
477+
```
478+
467479
## noCompileLinks
468480

469481
- 类型: `Array`
@@ -533,7 +545,7 @@ window.$docsify = {
533545
Example:
534546

535547
- 尝试访问`/de/overview`,如果存在则显示
536-
- 如果不存在则尝试`/overview`(取决于默认语言),如果存在即显示
548+
- 如果不存在则尝试`/overview`(取决于默认语言),如果存在即显示
537549
- 如果也不存在,显示404页面
538550

539551
```js
@@ -587,3 +599,104 @@ window.$docsify = {
587599
topMargin: 90, // default: 0
588600
};
589601
```
602+
603+
## vueComponents
604+
605+
- type: `Object`
606+
607+
创建并注册全局 [Vue组件](https://vuejs.org/v2/guide/components.html) 。组件是以组件名称为键,以包含 Vue 选项的对象为值来指定的。组件`data`对每个实例都是唯一的,并且在用户浏览网站时不会持久。
608+
609+
```js
610+
window.$docsify = {
611+
vueComponents: {
612+
'button-counter': {
613+
template: `
614+
<button @click="count += 1">
615+
You clicked me {{ count }} times
616+
</button>
617+
`,
618+
data() {
619+
return {
620+
count: 0,
621+
};
622+
},
623+
},
624+
},
625+
};
626+
```
627+
628+
```markdown
629+
<button-counter></button-counter>
630+
```
631+
632+
<output data-lang="output">
633+
<button-counter></button-counter>
634+
</output>
635+
636+
## vueGlobalOptions
637+
638+
- type: `Object`
639+
640+
指定 [Vue选项](https://vuejs.org/v2/api/#Options-Data) ,用于未明确使用[vueMounts](#mounting-dom-elements)[vueComponents](#components)[markdown脚本](#markdown-script)挂载的 Vue 内容。对全局`data`的更改将持续存在,并在任何使用全局引用的地方得到反映。
641+
642+
```js
643+
window.$docsify = {
644+
vueGlobalOptions: {
645+
data() {
646+
return {
647+
count: 0,
648+
};
649+
},
650+
},
651+
};
652+
```
653+
654+
```markdown
655+
<p>
656+
<button @click="count -= 1">-</button>
657+
{{ count }}
658+
<button @click="count += 1">+</button>
659+
</p>
660+
```
661+
662+
<output data-lang="output">
663+
<p>
664+
<button @click="count -= 1">-</button>
665+
{{ count }}
666+
<button @click="count += 1">+</button>
667+
</p>
668+
</output>
669+
670+
## vueMounts
671+
672+
- type: `Object`
673+
674+
指定要挂载为 [Vue实例](https://vuejs.org/v2/guide/instance.html) 的 DOM 元素及其相关选项。挂载元素使用 [CSS选择器](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) 作为键,并使用包含 Vue 选项的对象作为其值。每次加载新页面时,Docsify 将挂载主内容区域中第一个匹配的元素。挂载元素`data`对每个实例来说都是唯一的,并且不会在用户浏览网站时持久存在。
675+
676+
```js
677+
window.$docsify = {
678+
vueMounts: {
679+
'#counter': {
680+
data() {
681+
return {
682+
count: 0,
683+
};
684+
},
685+
},
686+
},
687+
};
688+
```
689+
690+
```markdown
691+
<div id="counter">
692+
<button @click="count -= 1">-</button>
693+
{{ count }}
694+
<button @click="count += 1">+</button>
695+
</div>
696+
```
697+
698+
<output id="counter">
699+
<button @click="count -= 1">-</button>
700+
{{ count }}
701+
<button @click="count += 1">+</button>
702+
</output>

plugins.md

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@
6262
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
6363
```
6464

65+
当执行全文搜索时,该插件会忽略双音符(例如,"cafe" 也会匹配 "café")。像 IE11 这样的旧版浏览器需要使用以下 [String.normalize()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize) polyfill 来忽略双音符:
66+
67+
```html
68+
<script src="//polyfill.io/v3/polyfill.min.js?features=String.prototype.normalize"></script>
69+
```
70+
6571
## 谷歌统计 - Google Analytics
6672

6773
需要配置 track id 才能使用。
@@ -91,6 +97,8 @@
9197
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/emoji.min.js"></script>
9298
```
9399

100+
?> 如果你不想解析成表情符号,可以使用__colon_<span>_</span>或`&#58;`。如果你需要在标题中使用,我们建议使用`&#58;`。例如,`&#58;100:`
101+
94102
## 外链脚本 - External Script
95103

96104
如果文档里的 script 是内联脚本,可以直接执行;而如果是外链脚本(即 js 文件内容由 `src` 属性引入),则需要使用此插件。

quickstart.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,22 @@ docsify serve docs
6363

6464
如果你的系统里安装了 Python 的话,也可以很容易地启动一个静态服务器去预览你的网站。
6565

66-
```bash
66+
```python2
6767
cd docs && python -m SimpleHTTPServer 3000
6868
```
6969

70+
```python3
71+
cd docs && python -m http.server 3000
72+
```
73+
7074
## Loading 提示
7175

7276
初始化时会显示 `Loading...` 内容,你可以自定义提示信息。
7377

7478

7579
```html
7680
<!-- index.html -->
77-
81+
7882
<div id="app">加载中</div>
7983
```
8084

0 commit comments

Comments
 (0)