JS代码
window.$('document').ready(() => {
// 我的工作台页面,左侧导航栏高度适配页面高度
const windowHeight = document.documentElement.clientHeight
const menuListHeight = windowHeight - 80 + 'px'
const contentListHeight = windowHeight - 101 + 'px'
window.$('.workbenchdiv1').css('height', menuListHeight)
window.$('.workbenchdiv2').css('height', contentListHeight)
// 我的工作台页面,左侧导航栏的下拉菜单
window.$('.have-list ul:nth-child(1)').on('click', function () {
window.$(this).siblings().slideToggle()
})
// 左侧导航栏,交互效果
window.$('.no-list').on('click', function () {
})
})
ready
事件,是第一次进入到页面,文档加载完成后触发。之后不会再被触发。如果想每次进入到首页都执行这段代码,即每次进入到这个路由都执行这段代码,只要放在
mounted
钩子函数中执行就OK。