van-popup滑动卡顿并且在有时候在ios上经常性滑动卡顿的情况

解决”pc端页面可以滚动,移动端手势无法滚动“问题的一次经历 - 掘金

 <van-popup v-model="studentclassShow" :lock-scroll="false" position="bottom" style="z-index: 3000" :style="{ height: '55%' }">
      <div class="gradecontent">
        <div class="toptitle" style="padding: 0.34rem">
          班级
          <img class="icon_x" @click="studentclassShow = false" src="../../../../../assets/xx.png" alt="" />
        </div>
        <div class="content_box" style="padding-top: 1rem">
          <div class="detail">
            <!-- <div class="detail_title">{{ item.title }}</div> -->
            <div class="detail_content">
              <div
                v-for="item in classesDict"
                :class="{ checkedclass: selectedclass == item.value }"
                :key="item.value"
                class="detail_box"
                @click="checkedclassitem(item)"
              >
                {{ item.studentClass }}
              </div>
            </div>
          </div>
        </div>
        <div class="btn_box">
          <div class="submit-btn" @click="confimclass()">确定</div>
        </div>
      </div>
    </van-popup>

:lock-scroll="false"加了这个属性就可以了具体去看官网。

然后苹果手机卡顿情况是pop里层的设置的z-index大于了pop本身的默认z-idenx2008,设置成一样的就可以了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
首先,你需要安装 Vue.js 和 Vant UI 组件库。然后,你可以创建一个名为 CustomContent 的组件,并在其引入 van-popupvan-dropdown-menu 组件。 ```html <template> <div> <van-popup v-model="showPopup" position="bottom"> <van-dropdown-menu> <van-dropdown-item v-for="(item, index) in menuItems" :key="index" @click="handleClick(item)"> {{ item }} </van-dropdown-item> </van-dropdown-menu> </van-popup> <div v-html="content"></div> </div> </template> <script> import { VanPopup, VanDropdownMenu, VanDropdownItem } from 'vant'; export default { name: 'CustomContent', components: { VanPopup, VanDropdownMenu, VanDropdownItem }, props: { content: { type: String, default: '' } }, data() { return { showPopup: false, menuItems: ['Item 1', 'Item 2', 'Item 3'] }; }, methods: { handleClick(item) { console.log(item); this.showPopup = false; } } }; </script> ``` 在其他页面,你可以像下面这样使用 CustomContent 组件,并传入需要展示的内容作为 prop。 ```html <template> <div> <custom-content :content="customContent"></custom-content> </div> </template> <script> import CustomContent from '@/components/CustomContent.vue'; export default { name: 'OtherPage', components: { CustomContent }, data() { return { customContent: '<p>This is custom content.</p>' }; } }; </script> ``` 这样,你就可以在其他页面使用自定义的组件,并且在组件展示 van-popupvan-dropdown-menu 组件了。同时,你也可以在组件展示其他内容,不仅限于传入的 prop 内容。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值