1
0
mirror of https://gitee.com/tawords/tawords-docs synced 2025-01-10 19:38:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

drawio viewer.js按需加载&延时加载,保证页面加载速度

This commit is contained in:
程序员小墨 2021-08-07 02:15:48 +08:00
parent 6793ff7a27
commit 2ef1a5f52b
4 changed files with 26 additions and 10 deletions

View File

@ -1,6 +1,6 @@
<!-- 背Ta单词 简介 --> <!-- 背Ta单词 简介 -->
[plugin-structures](include/intro.md ':include') [intro](include/intro.md ':include')
## 传送门 ## 传送门

View File

@ -0,0 +1,12 @@
<script>
// 加载较慢,延时加载
setTimeout(function(){
var drawioViewerScript = document.createElement("script");
drawioViewerScript.src = "static/docsify/lib/plugins/docsify-drawio/viewer.min.js";
document.body.appendChild( drawioViewerScript );
}, 10)
</script>
<!-- include/import-drawio-viewer-script.md -->

View File

@ -6,10 +6,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="背Ta单词 官方文档"> <meta name="description" content="背Ta单词 官方文档">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<!-- 主题样式 --> <!-- 主题样式 -->
<link rel="stylesheet" href="static/docsify/lib/themes/vue.css"> <link rel="stylesheet" href="static/docsify/lib/themes/vue.css">
<link rel="shortcut icon" href="favicon.ico" /> <link rel="shortcut icon" href="favicon.ico" />
</head> </head>
@ -47,7 +47,10 @@
// 启用相对路径 // 启用相对路径
// relativePath: true, // relativePath: true,
// 执行文档里的 script 标签里的脚本,只执行第一个 script
executeScript: true,
// 小屏设备下合并导航栏到侧边栏。 // 小屏设备下合并导航栏到侧边栏。
mergeNavbar: true, mergeNavbar: true,
@ -195,12 +198,11 @@
<script src="static/docsify/lib/plugins/docsify-pagination@2.6.1/docsify-pagination.min.js"></script> <script src="static/docsify/lib/plugins/docsify-pagination@2.6.1/docsify-pagination.min.js"></script>
<!-- drawio --> <!-- drawio -->
<!-- <script src="https://cdn.jsdelivr.net/npm/docsify-drawio/viewer.min.js"></script> --> <!-- <script src="https://cdn.jsdelivr.net/npm/docsify-drawio/viewer.min.js"></script>
<script src="static/docsify/lib/plugins/docsify-drawio/viewer.min.js"></script> <script src='https://cdn.jsdelivr.net/npm/docsify-drawio/drawio.js'></script> -->
<!-- <script src='https://cdn.jsdelivr.net/npm/docsify-drawio/drawio.js'></script> --> <!-- <script src="static/docsify/lib/plugins/docsify-drawio/viewer.min.js"></script> -->
<script src='static/docsify/lib/plugins/docsify-drawio/drawio.js'></script> <script src='static/docsify/lib/plugins/docsify-drawio/drawio.js'></script>
<!-- docsify-tabs (latest v1.x.x) --> <!-- docsify-tabs (latest v1.x.x) -->
<!-- https://jhildenbiddle.github.io/docsify-tabs/#/ --> <!-- https://jhildenbiddle.github.io/docsify-tabs/#/ -->
<!-- <script src="https://cdn.jsdelivr.net/npm/docsify-tabs@1"></script> --> <!-- <script src="https://cdn.jsdelivr.net/npm/docsify-tabs@1"></script> -->

View File

@ -1,9 +1,11 @@
# drawio # drawio
[filename](https://cdn.jsdelivr.net/npm/docsify-drawio/test.drawio ':include :type=code') <!-- 引入drawio viewer.js -->
[intro](../include/import-drawio-viewer-script.md ':include')
[测试](https://cdn.jsdelivr.net/npm/docsify-drawio/test.drawio ':include :type=code')
----- -----
# 深色背景 <!-- 深色背景 --> # 深色背景 <!-- 深色背景 -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/dark.css" /> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/dark.css" />