Skip to content

Update docs for 4.12.0 #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 114 additions & 1 deletion configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,18 @@ window.$docsify = {
};
```

## crossOriginLinks

- type: `Array`

当设置了`routerMode:'history'`时,你可能会面临跨域的问题,参见 [#1379](https://github.com/docsifyjs/docsify/issues/1379) 。在 Markdown 内容中,有一个简单的方法可以解决,参见[helpers](zh-cn/helpers.md) 中的跨域链接。

```js
window.$docsify = {
crossOriginLinks: ['https://example.com/cross-origin-link'],
};
```

## noCompileLinks

- 类型: `Array`
Expand Down Expand Up @@ -533,7 +545,7 @@ window.$docsify = {
Example:

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

```js
Expand Down Expand Up @@ -587,3 +599,104 @@ window.$docsify = {
topMargin: 90, // default: 0
};
```

## vueComponents

- type: `Object`

创建并注册全局 [Vue组件](https://vuejs.org/v2/guide/components.html) 。组件是以组件名称为键,以包含 Vue 选项的对象为值来指定的。组件`data`对每个实例都是唯一的,并且在用户浏览网站时不会持久。

```js
window.$docsify = {
vueComponents: {
'button-counter': {
template: `
<button @click="count += 1">
You clicked me {{ count }} times
</button>
`,
data() {
return {
count: 0,
};
},
},
},
};
```

```markdown
<button-counter></button-counter>
```

<output data-lang="output">
<button-counter></button-counter>
</output>

## vueGlobalOptions

- type: `Object`

指定 [Vue选项](https://vuejs.org/v2/api/#Options-Data) ,用于未明确使用[vueMounts](#mounting-dom-elements)、[vueComponents](#components)或[markdown脚本](#markdown-script)挂载的 Vue 内容。对全局`data`的更改将持续存在,并在任何使用全局引用的地方得到反映。

```js
window.$docsify = {
vueGlobalOptions: {
data() {
return {
count: 0,
};
},
},
};
```

```markdown
<p>
<button @click="count -= 1">-</button>
{{ count }}
<button @click="count += 1">+</button>
</p>
```

<output data-lang="output">
<p>
<button @click="count -= 1">-</button>
{{ count }}
<button @click="count += 1">+</button>
</p>
</output>

## vueMounts

- type: `Object`

指定要挂载为 [Vue实例](https://vuejs.org/v2/guide/instance.html) 的 DOM 元素及其相关选项。挂载元素使用 [CSS选择器](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) 作为键,并使用包含 Vue 选项的对象作为其值。每次加载新页面时,Docsify 将挂载主内容区域中第一个匹配的元素。挂载元素`data`对每个实例来说都是唯一的,并且不会在用户浏览网站时持久存在。

```js
window.$docsify = {
vueMounts: {
'#counter': {
data() {
return {
count: 0,
};
},
},
},
};
```

```markdown
<div id="counter">
<button @click="count -= 1">-</button>
{{ count }}
<button @click="count += 1">+</button>
</div>
```

<output id="counter">
<button @click="count -= 1">-</button>
{{ count }}
<button @click="count += 1">+</button>
</output>
8 changes: 8 additions & 0 deletions plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
```

当执行全文搜索时,该插件会忽略双音符(例如,"cafe" 也会匹配 "café")。像 IE11 这样的旧版浏览器需要使用以下 [String.normalize()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize) polyfill 来忽略双音符:

```html
<script src="//polyfill.io/v3/polyfill.min.js?features=String.prototype.normalize"></script>
```

## 谷歌统计 - Google Analytics

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

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

## 外链脚本 - External Script

如果文档里的 script 是内联脚本,可以直接执行;而如果是外链脚本(即 js 文件内容由 `src` 属性引入),则需要使用此插件。
Expand Down
8 changes: 6 additions & 2 deletions quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,22 @@ docsify serve docs

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

```bash
```python2
cd docs && python -m SimpleHTTPServer 3000
```

```python3
cd docs && python -m http.server 3000
```

## Loading 提示

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


```html
<!-- index.html -->

<div id="app">加载中</div>
```

Expand Down
Loading