From 9b1d2b73b1e7fc01e320eea21cb7060cc820ce8e Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Thu, 5 May 2022 14:36:02 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E5=8F=AA=E6=9C=89=E4=B8=80=E7=BA=A7?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=97=B6=E4=B8=8D=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/theme/components/Navbar.vue | 20 +++++++++++++++++--- docs/.vuepress/theme/config/navbar.js | 14 +++++++------- docs/api/plugins/getEnterOptionsSync.md | 2 +- docs/api/plugins/getLaunchOptionsSync.md | 2 +- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/docs/.vuepress/theme/components/Navbar.vue b/docs/.vuepress/theme/components/Navbar.vue index d9e5ab3e5..cb836d610 100644 --- a/docs/.vuepress/theme/components/Navbar.vue +++ b/docs/.vuepress/theme/components/Navbar.vue @@ -125,9 +125,19 @@ export default { this.navbarHeight = this.navbar.clientHeight this.subNavBarHeight = this.subNavBar.clientHeight this.mainNavBarHeight = this.mainNavBar.clientHeight + this.scrollBehavior() + }, + scrollBehavior () { this.removeWindowScroll() + this.onWindowScroll() + if(this.showSubNavBar) { + this.addWindowScroll() + } else { + this.fixedNavbar = true + } + }, + addWindowScroll () { if (os.pc) { - this.onWindowScroll() window.addEventListener('scroll', this.onWindowScroll, false) } }, @@ -137,10 +147,12 @@ export default { this.sideBar && this.sideBar.removeAttribute('style') this.vuepressToc && this.vuepressToc.removeAttribute('style') this.navbar && this.navbar.removeAttribute('style') - this.pageContainer && (this.pageContainer.style.marginTop = 'auto') + if (this.pageContainer) { + this.pageContainer.style.marginTop = this.showSubNavBar ? 'auto' : `${this.navbarHeight}px` + } }, onWindowScroll () { - const scrollTop = document.documentElement.scrollTop || document.body.scrollTop; + const scrollTop = !this.showSubNavBar ? 0 : document.documentElement.scrollTop || document.body.scrollTop; if (!this.fixedNavbar) { let sideTop = this.navbarHeight - scrollTop @@ -190,10 +202,12 @@ export default { watch: { fixedNavbar () { this.fixedSideBarHeight() + this.scrollBehavior() }, 'navConfig.userNavIndex' () { this.$nextTick(()=>{ this.fixedSideBarHeight() + this.scrollBehavior() }) } } diff --git a/docs/.vuepress/theme/config/navbar.js b/docs/.vuepress/theme/config/navbar.js index d26f7f4f5..599bb2795 100644 --- a/docs/.vuepress/theme/config/navbar.js +++ b/docs/.vuepress/theme/config/navbar.js @@ -96,11 +96,11 @@ export const navbar = [ type: 'link', link: 'https://mp.kuaishou.com/docs/develop/frame/config/conf_appjson.html' }, - { - text: '京东小程序', - type: 'link', - link: 'https://mp-docs.jd.com/framework/' - }, + { + text: '京东小程序', + type: 'link', + link: 'https://mp-docs.jd.com/framework/' + }, { text: '华为快应用', type: 'link', @@ -118,12 +118,12 @@ export const navbar = [ }, ] }, - /* { + { link: "https://github.com/dcloudio/uni-app", target: "_blank", text: "GitHub", type: "link" - } */ + } ] }, { diff --git a/docs/api/plugins/getEnterOptionsSync.md b/docs/api/plugins/getEnterOptionsSync.md index 89200c92b..c31ec63d8 100644 --- a/docs/api/plugins/getEnterOptionsSync.md +++ b/docs/api/plugins/getEnterOptionsSync.md @@ -14,7 +14,7 @@ |scene|Number|启动时的场景值,具体值含义请查看各平台文档说明|其他平台均支持,`字节小程序(1.12.0)`| |query|Object|启动时的 query 参数|其他平台均支持,`字节小程序(1.12.0)`| |referrerInfo|Object|来源信息。如果没有则返回 `{}`|其他平台均支持,`字节小程序(1.15.0)`| -|forwardMaterials|Array.|打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数|`微信小程序`| +|forwardMaterials|Array.\|打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数|`微信小程序`| |chatType|number|打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数|`仅微信小程序`| |apiCategory|string|API 类别|`仅微信小程序(2.20.0)`| |showFrom|number|唤起小程序的方式,目前取值固定为 10,表示通过 schema 唤起|`仅字节小程序(1.90.0)`| diff --git a/docs/api/plugins/getLaunchOptionsSync.md b/docs/api/plugins/getLaunchOptionsSync.md index 35a4fcef2..c96f854a6 100644 --- a/docs/api/plugins/getLaunchOptionsSync.md +++ b/docs/api/plugins/getLaunchOptionsSync.md @@ -14,7 +14,7 @@ |scene|Number|启动时的场景值,具体值含义请查看各平台文档说明。钉钉小程序在 IDE 恒为0000,真机不支持。|其他平台均支持,`字节小程序(1.12.0)`| |query|Object|启动时的 query 参数|其他平台均支持,`字节小程序(1.12.0)`| |referrerInfo|Object|来源信息。如果没有则返回 `{}`|其他平台均支持,`字节小程序(1.15.0)`,`飞书小程序不支持`,`钉钉小程序不支持`| -|forwardMaterials|Array.|打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数|`微信小程序`、`QQ小程序`| +|forwardMaterials|Array.\|打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数|`微信小程序`、`QQ小程序`| |entryDataHash|string|群入口信息,通过群应用商店打开、群分享卡片打开的小程序可获得|`仅QQ小程序`| |chatType|number|打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数|`仅微信小程序`| |apiCategory|string|API 类别|`仅微信小程序(2.20.0)`| -- GitLab