@@ -464,6 +464,18 @@ window.$docsify = {
464
464
};
465
465
```
466
466
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
+
467
479
## noCompileLinks
468
480
469
481
- 类型: ` Array `
@@ -533,7 +545,7 @@ window.$docsify = {
533
545
Example:
534
546
535
547
- 尝试访问` /de/overview ` ,如果存在则显示
536
- - 如果不存在则尝试` /overview ` (取决于默认语言),如果存在即显示
548
+ - 如果不存在则尝试` /overview ` (取决于默认语言),如果存在即显示
537
549
- 如果也不存在,显示404页面
538
550
539
551
``` js
@@ -587,3 +599,104 @@ window.$docsify = {
587
599
topMargin: 90 , // default: 0
588
600
};
589
601
```
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 >
0 commit comments