-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 [Bug]: [NavMenu]导航栏并没有溢出,但是显示为折叠状态 #2528
Comments
Title: [NavMenu]The navigation bar does not overflow, but is displayed in a collapsed state |
目前只能通过等待navmenu加载完成后再加载router-view解决: <template>
<div id="defaultLayout">
<tiny-layout ref="navMenu">
<tiny-nav-menu :data="menuData" style="height: 50px">
<!-- logo -->
<template #logo>
<tiny-image fit="fill" :src="getImg()" style="height: 40px" />
</template>
<!-- toolbar -->
<template #toolbar>
<tiny-layout style="width: 200px">
<tiny-search mini placeholder="请输入关键词"></tiny-search>
</tiny-layout>
<tiny-divider direction="vertical"></tiny-divider>
<tiny-badge is-dot :hidden="true">
<template #default>
<tiny-button :icon="IconPublicNotice" circle></tiny-button>
</template>
</tiny-badge>
<tiny-divider direction="vertical"></tiny-divider>
<tiny-user-head type="icon" round min></tiny-user-head>
</template>
</tiny-nav-menu>
</tiny-layout>
<tiny-layout class="content-and-footer">
<tiny-row id="oj-content">
<router-view v-slot="{ Component }" v-if="!isNavMenuLoading">
<component :is="Component" />
</router-view>
</tiny-row>
<tiny-row class="layout-footer">
<span> KOJ KCode Online Judge ©2024 Created by KyLen </span>
</tiny-row>
</tiny-layout>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount, nextTick, watchEffect } from 'vue'
import { iconPublicNotice } from '@opentiny/vue-icon'
const IconPublicNotice = iconPublicNotice()
// 获得logo图片
const getImg = () => {
return new URL(`@/assets/logo-koj.png`, import.meta.url).href
}
// 菜单数据
const menuData = ref([
{
title: '首页',
url: '/home'
},
{
title: '题目集',
url: '/problemset'
},
{
title: '在线调试',
url: '/debug'
},
{
title: '评测队列',
url: '/queue'
}
])
// 等待菜单加载完成后再显示内容
const navMenu = ref(null)
const isNavMenuLoading = ref(true)
watchEffect(() => {
if (navMenu.value) {
isNavMenuLoading.value = false
}
})
</script> |
本地用你的代码没有复现该问题,小屏幕也是没有问题的,是不是你们设置的全局样式影响了,可以给nav-menu或者它的父元素加个宽度 |
Using your code locally does not reproduce the problem, and there is no problem with small screens. Is it affected by the global style you set? You can add a width to nav-menu or its parent element. |
router-view里面我用了tiny-grid,然后出现的这个问题,我重新开了一个干净的vite项目,编写了复现上述问题的最简的App.vue的代码: <template>
<div>
<tiny-nav-menu :data="menuData"> </tiny-nav-menu>
<tiny-grid :data="data">
<tiny-grid-column field="problem_id" title="ID"></tiny-grid-column>
<tiny-grid-column field="title" title="标题"> </tiny-grid-column>
<tiny-grid-column field="difficulty" title="难度"></tiny-grid-column>
<tiny-grid-column field="acNumber" title="已通过"></tiny-grid-column>
</tiny-grid>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { TinyNavMenu, TinyGrid, TinyGridColumn } from '@opentiny/vue'
const data = ref([
{
problem_id: 1,
title: 'test',
difficulty: 100,
acNumber: 0,
status: '0'
}
])
const menuData = ref([
{
title: '首页',
url: '/home'
},
{
title: '题目集',
url: '/problemset'
},
{
title: '在线调试',
url: '/debug'
},
{
title: '评测队列',
url: '/queue'
}
])
</script>
<style scoped></style>
|
Version
3.19.0
Vue Version
5.0.8
Link to minimal reproduction
页面初始化,导航栏如下所示:
实际情况是,导航栏只有四个菜单,应该不会溢出而显示“更多”
在按住ctrl并滑动鼠标滚轮来缩放页面后,导航栏恢复了正常:
Step to reproduce
What is expected
No response
What is actually happening
No response
What is your project name
KOJ
Any additional comments (optional)
No response
The text was updated successfully, but these errors were encountered: