ie打开li下的菜单会被后面的菜单浮上来覆盖,height: min-content; 不生效

本文探讨了在IE浏览器中,使用height:min-content导致菜单显示异常的问题,并分享了解决方案,即将其改为height:auto,使菜单正常显示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ie打开li下的菜单会被后面的菜单浮上来覆盖

2、首先想到是打开的li下菜单没有高度,试着设置height: xpx;发现下面的菜单没有浮上来了,正常显示,想到应该是在ie某个表示高度的属性不生效

调试发现是height: min-content; 不生效,将其改成height: auto; 之后在ie就正常显示了。

查询发现:

 

<template> <div class="editor-layout"> <!-- 固定头部 --> <header class="app-header"> <button class="back-btn" @click="handleBack"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M19 12H5M12 19l-7-7 7-7"/> </svg> </button> <h1 class="app-title">AI笔记编辑器</h1> <div class="header-right"> <button class="history-btn" @click="toggleHistory"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <circle cx="12" cy="12" r="10"></circle> <polyline points="12 6 12 12 16 14"></polyline> </svg> <span>历史记录</span> </button> <div class="user-avatar" @click="goToProfile"> <div class="avatar-placeholder"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path> <circle cx="12" cy="7" r="4"></circle> </svg> </div> </div> </div> </header> <!-- 固定工具栏 --> <div class="fixed-toolbar"> <Toolbar :editor="editorRef" :defaultConfig="toolbarConfig" /> </div> <!-- 编辑器区域 --> <div class="editor-container"> <Editor v-model="valueHtml" :defaultConfig="editorConfig" @onChange="handleChange" @onCreated="handleCreated" @onDestroyed="handleDestroyed" @onFocus="handleFocus" @onBlur="handleBlur" @customAlert="customAlert" @customPaste="customPaste" /> </div> <!-- 历史记录侧边栏 --> <div class="history-sidebar" :class="{ active: showHistory }"> <div class="sidebar-header"> <h2>历史记录</h2> <button class="close-btn" @click="toggleHistory"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <line x1="18" y1="6" x2="6" y2="18"></line> <line x1="6" y1="6" x2="18" y2="18"></line> </svg> </button> </div> <div class="history-list"> <div v-for="(item, index) in historyItems" :key="index" class="history-item"> <div class="history-title">{{ item.title }}</div> <div class="history-date">{{ item.date }}</div> </div> </div> </div> <!-- 历史记录遮罩 --> <div v-if="showHistory" class="sidebar-mask" @click="toggleHistory"></div> </div> </template> <script setup> import { onBeforeUnmount, ref, shallowRef } from 'vue' import { Editor, Toolbar } from '@wangeditor/editor-for-vue' import '@wangeditor/editor/dist/css/style.css' // 编辑器实例 const editorRef = shallowRef() // 内容 HTML const valueHtml = ref('<h1>欢迎使用AI笔记编辑器</h1><p>这是一个功能强大的富文本编辑器,支持多种格式和功能。</p><p>尝试使用工具栏上的功能来编辑内容!</p>') // 编辑器配置 const editorConfig = { placeholder: '请输入内容...', MENU_CONF: { insertImage: { checkImage(src) { if (src.indexOf("http") !== 0) { return "图片网址必须以 http/https 开头"; } return true; }, }, } } // 工具栏配置 const toolbarConfig = { toolbarKeys: [ 'headerSelect', 'bold', 'italic', 'underline', 'through', 'color', 'bgColor', 'fontSize', 'fontFamily', 'lineHeight', 'bulletedList', 'numberedList', 'todo', 'justifyLeft', 'justifyRight', 'justifyCenter', 'insertLink', 'insertImage', 'insertTable', 'codeBlock', 'blockquote', 'divider', 'emotion', 'undo', 'redo' ] } // 历史记录相关状态 const showHistory = ref(false) const historyItems = ref([ { title: 'AI生成的学习笔记', date: '2023-10-15 14:30' }, { title: '项目会议记录', date: '2023-10-14 09:45' }, { title: '技术方案设计', date: '2023-10-12 16:20' }, { title: '读书笔记 - 人工智能导论', date: '2023-10-10 11:15' }, { title: '周计划安排', date: '2023-10-08 08:30' } ]) // 编辑器回调函数 const handleCreated = (editor) => { editorRef.value = editor console.log("编辑器已创建", editor) } const handleChange = (editor) => { console.log("内容变化:", editor.children) } const handleDestroyed = (editor) => { console.log('编辑器已销毁', editor) } const handleFocus = (editor) => { console.log('编辑器获得焦点', editor) } const handleBlur = (editor) => { console.log('编辑器失去焦点', editor) } const customAlert = (info, type) => { alert(`【系统提示】${type} - ${info}`) } const customPaste = (editor, event, callback) => { console.log('粘贴事件', event) callback(true) // 继续默认的粘贴行为 } // 及时销毁编辑器 onBeforeUnmount(() => { const editor = editorRef.value if (editor == null) return editor.destroy() }) // 头部按钮功能 const handleBack = () => { alert('返回操作') } const toggleHistory = () => { showHistory.value = !showHistory.value } const goToProfile = () => { alert('跳转到个人用户管理界面') } </script> <style> /* 基础样式重置 */ * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } .editor-layout { position: relative; height: 100vh; overflow: hidden; background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%); } /* 固定头部样式 */ .app-header { position: fixed; top: 0; left: 0; right: 0; height: 60px; display: flex; align-items: center; padding: 0 20px; background: #ffffff; box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1); z-index: 1000; transition: all 0.3s ease; } .back-btn { width: 40px; height: 40px; border: none; background: none; cursor: pointer; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; } .back-btn:hover { background: #f0f5ff; transform: translateX(-2px); } .back-btn svg { width: 20px; height: 20px; color: #4a6cf7; } .app-title { flex: 1; text-align: center; font-size: 1.4rem; font-weight: 600; color: #1a1a1a; letter-spacing: 0.5px; } .header-right { display: flex; align-items: center; gap: 15px; } .history-btn { display: flex; align-items: center; gap: 6px; padding: 8px 15px; background: #f0f5ff; border: none; border-radius: 20px; color: #4a6cf7; font-weight: 500; font-size: 0.9rem; cursor: pointer; transition: all 0.2s ease; } .history-btn:hover { background: #e1e9ff; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(74, 108, 247, 0.2); } .history-btn svg { width: 18px; height: 18px; } .user-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 10px rgba(118, 75, 162, 0.3); } .user-avatar:hover { transform: scale(1.05); box-shadow: 0 6px 15px rgba(118, 75, 162, 0.4); } .avatar-placeholder { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.2); } .avatar-placeholder svg { width: 18px; height: 18px; color: white; } /* 固定工具栏样式 */ .fixed-toolbar { position: fixed; top: 60px; /* 在头部下方 */ left: 0; right: 0; z-index: 999; background: white; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); border-bottom: 1px solid #eaeef5; padding: 0 10px; } /* 编辑器容器样式 */ .editor-container { margin-top: 110px; /* 头部高度 + 工具栏高度 */ height: calc(100vh - 110px); overflow-y: auto; padding: 20px; background: white; border-radius: 12px; margin-left: 20px; margin-right: 20px; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05); } /* 历史记录侧边栏 */ .history-sidebar { position: fixed; top: 0; right: -400px; width: 380px; height: 100vh; background: white; z-index: 2000; box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1); transition: right 0.4s cubic-bezier(0.23, 1, 0.32, 1); display: flex; flex-direction: column; } .history-sidebar.active { right: 0; } .sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid #eee; } .sidebar-header h2 { color: #333; font-weight: 600; } .close-btn { background: none; border: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease; } .close-btn:hover { background: #f5f7fa; } .close-btn svg { width: 20px; height: 20px; color: #666; } .history-list { flex: 1; overflow-y: auto; padding: 15px; } .history-item { padding: 15px; border-radius: 8px; margin-bottom: 10px; background: #f9fbfd; transition: all 0.2s ease; cursor: pointer; border-left: 3px solid #4a6cf7; } .history-item:hover { background: #edf3ff; transform: translateX(5px); } .history-title { font-weight: 500; color: #1a1a1a; margin-bottom: 5px; } .history-date { font-size: 0.85rem; color: #666; } /* 历史记录遮罩 */ .sidebar-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.4); z-index: 1500; backdrop-filter: blur(2px); } /* 响应式设计 */ @media (max-width: 768px) { .app-header { padding: 0 10px; } .app-title { font-size: 1.1rem; } .history-btn span { display: none; } .editor-container { margin-left: 10px; margin-right: 10px; padding: 15px; } .history-sidebar { width: 85%; } } /* 滚动条美化 */ ::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; } ::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; } ::-webkit-scrollbar-thumb:hover { background: #a8a8a8; } </style> 我是说这个编辑器调宽一点,然后滚轮是页面的
最新发布
07-26
在该vue项目下怎样将底部导航栏<footer>组件固定在底部,在不同设备打开时也不会位移,请提供修改后的完善代码:<template> <!-- 唯一根元素开始 --> <div class="container"> <!-- 顶部导航栏 --> <NavBar /> <!-- 中心大图展示区域 --> <section class="hero-section"> <img src="@/assets/recreation/fitness.png" alt="健身房内部场景" class="hero-image" > </section> <!-- 文字说明区域 --> <main class="content-section"> <section class="description"> <h2>活力健身房:城市上空的运动乌托邦</h2> <p>全景落地窗俯瞰草原与城市天际线,配备智能体测系统与专业训练器械,从有氧区到自由重量区私教课程结合蒙式体能训练法,让汗水挥洒成诗。恒温泳池与瑜伽室演绎健身快乐间奏曲,晨起泳姿划破朝阳,暮色中禅定瑜伽随音乐舒展,打造24小时不间断的健康生活场。</p> </section> <section class="rules"> <h3>蒙发国际温泉度假酒店多功能健身房设施使用守则</h3> <ul> <li>1、使用资格与时间</li> <p>-住店客人全天24小时刷卡进入,健身设施仅向住店客人开放。</p> <li>2、使用前准备</li> <p>-使用者需先熟悉各项设施使用说明,熟悉健身器材操作,有疑问可寻求工作人员帮助。</p> <li>3、场地使用规则</li> <p>-遵循先到先得原则,不设预订。</p> <p>-多功能活动室任何时间内最多允许十二名使用者同时在场。</p> <p>-室内不准饮食,需保持整洁。</p> <p>-须穿着合适运动服装及运动鞋,违反者校方有权拒绝其入场。</p> <li>4、健康与安全提示</li> <p>-患高血压、哮喘、心脏病或身体不适者,建议暂停使用。</p> <p>-运动前做10-15分钟热身,运动后做10分钟放松活动。</p> <p>-感到不适或痛楚,立刻停止运动并通知工作人员。</p> <p>-远离摆动中的健身设施或器材。</p> <li>5、器材使用规范</li> <p>-不能改动健身设施或器材原有位置。</p> <p>-有他人等待时,使用器材限时30分钟。</p> <p>-运动后将健身器材放回原处,用消毒剂喷雾擦拭。</p> <p>-操作前检查器材是否正常安全,发现故障/损坏,停止使用并通知酒店,勿自行维修。</p> <p>-损坏或遗失器材需赔偿。</p> <li>6、其他注意事项</li> <p>-未经同意,严禁在场内拍照、录影或录音。</p> <p>-酒店有权预留场地用于维修、清洁、训练班及活动安排。</p> <p>-酒店保留修改规则和规定的权利,恕不另行通知。</p> </ul> </section> </main> <!-- 底部导航栏 --> <Footer /> </div> <!-- 唯一根元素结束 --> </template> <script > import NavBar from '@/components/NavBar.vue'; export default { name: "ftness", data() { return { }; }, }; </script> <style > /* 健身区样式 */ .hero-section { position: relative; height: 60rem ; margin-top: 0rem; /* 补偿固定导航栏高度 */ overflow: hidden; } .hero-image { width: 100%; height: 100%; object-fit: cover; object-position: center; } .hero-title { position: absolute; bottom: 20%; left: 50%; transform: translateX(-50%); color: white; font-size: 3rem; text-shadow: 2px 2px 10px rgba(0,0,0,0.5); margin: 0; } /* 内容区样式 */ .content-section { max-width: 150rem; margin: 2rem auto; padding: 0 5%; line-height:2.4rem; } .description { margin-bottom: 3rem; padding: 2rem; background: #f8f9fa; border-radius: 1rem; font-size: 2.4rem; line-height: 4rem; margin: 6rem auto; font-family: "宋体"; } .rules { margin-top: 3rem; height: 100rem; padding: 2rem; background: white; border-radius: 1rem; box-shadow: 0 2px 10px rgba(0,0,0,0.05); font-size: 2rem; line-height: 3.8rem; font-family: "宋体"; text-align: left; } .rules h3 { color: #007bff; border-bottom: 2px solid #007bff; padding-bottom: 0.5rem; margin-bottom: 1rem; font-size: 2.4rem; text-align: center; } @media (max-width: 768px) { .navbar { flex-direction: column; padding: 1rem 5% 0.5rem; } .nav-left, .nav-right { width: 100%; flex-wrap: wrap; justify-content: center; margin-bottom: 0.5rem; } .nav-item { margin: 0.5rem; } .hero-title { font-size: 2rem; } } </style>
06-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值