Skip to content
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

当 nut-menu 和 nut-calendar 在一起使用有问题, 上下拉日期展示不全, 会变成空白 [bug] #1775

Closed
richard1015 opened this issue Oct 24, 2022 · 2 comments
Assignees

Comments

@richard1015
Copy link
Member

问题描述

最小可复现仓库

请创建最小可复现代码,并上传到你的 GitHub 仓库

预期的行为和实际行为

复现步骤,具体代码

相关环境信息

  • 操作系统
  • Node 版本
  • NutUI 版本: 查看项目package.json 中 @nutui/* 信息
  • Vue 版本
  • 引用方式: CDN / NPM ?
@eiinu eiinu self-assigned this Oct 25, 2022
@yangjisen
Copy link
Contributor

  • app.js
import { createApp } from 'vue'
import { Button, Toast, Menu, MenuItem, Calendar, Popup, OverLay, Cell} from '@nutui/nutui-taro';

import './app.scss'

const App = createApp({
  onShow (options) {},
  // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
})

App.use(Button).use(Toast)
App.use(Menu).use(MenuItem)
App.use(Calendar).use(Popup)
App.use(OverLay).use(Cell)

export default App
  • src/pages/index.vue
<template>
  <view class="index">
    <nut-menu>
      <nut-menu-item title="筛选" ref="item">
        <nut-calendar
            v-model:visible="isVisible"
            :poppable="false"
            :is-auto-back-fill="true"
            :show-title="false"
            :show-sub-title="false"
            :start-date="`2022-05-01`"
            :default-value="`2022-11-03`"
        />
      </nut-menu-item>
    </nut-menu>
  </view>
</template>

<script>
import { reactive, toRefs, ref  } from 'vue';

export default {
  setup() {
    const item = ref('');
    const state = reactive({
      isVisible: false
    });
    return {
      ...toRefs(state),
    };
  }
}
</script>

<style lang="scss">
.index {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
}
</style>

taro init 进行安装
直接修改 index.vue 为以上代码即可

image

image

image

@lkjh3214
Copy link
Contributor

lkjh3214 commented Nov 9, 2022

感谢反馈,该问题,是因为menu在展示时,menu-item中的元素也是默认进行渲染的,只不过被menu-item的容器被设置为display:none。平铺日历组件,在加载时会进行初始化,设置滚动偏移量。而当容器为display:none时,scrollTop无法进行设置。所以导致在display:none 变更为 block时,无法正确展示日期信息

@eiinu eiinu removed their assignment Dec 6, 2022
@lkjh3214 lkjh3214 self-assigned this Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

4 participants