当前位置: 首页 > news >正文

小程序uview actionSheet 内容过多高度设置

问题:u-action-sheet滚动不了

<u-action-sheet :list="list" v-model="show" @click="xxx"></u-action-sheet>

使用uview ui :u-action-sheet, 但是item太多,超出屏幕没法滚动, 去查官方文档的时候发现并没有设置滚动的属性

官方文档:ActionSheet 操作菜单 | uView 2.0 - 全面兼容 nvue 的 uni-app 生态框架 - uni-app UI 框架

解决办法:

第一步:修改源码

我这里用的HB转译的小程序,路径如下

找到node_modules   ->    uview_ui    ->   components     ->   u-action-sheet    ->   u-action-sheet.vue

<template><u-popup mode="bottom" :border-radius="borderRadius" :popup="false" v-model="value" :maskCloseAble="maskCloseAble"length="auto" :safeAreaInsetBottom="safeAreaInsetBottom" @close="popupClose" :z-index="uZIndex"><view class="u-tips u-border-bottom" v-if="tips.text" :style="[tipsStyle]">{{tips.text}}</view><!-- 增加个循环在block外层 --><scroll-view scroll-y style="min-height: 100rpx;max-height: 700rpx;"><block v-for="(item, index) in list" :key="index"><view@touchmove.stop.prevent@tap="itemClick(index)":style="[itemStyle(index)]"class="u-action-sheet-item u-line-1":class="[index < list.length - 1 ? 'u-border-bottom' : '']":hover-stay-time="150"><text>{{item.text}}</text><text class="u-action-sheet-item__subtext u-line-1" v-if="item.subText">{{item.subText}}</text></view></block></scroll-view><view class="u-gab" v-if="cancelBtn"></view><view @touchmove.stop.prevent class="u-actionsheet-cancel u-action-sheet-item" hover-class="u-hover-class":hover-stay-time="150" v-if="cancelBtn" @tap="close">{{cancelText}}</view></u-popup>
</template>

这个时候在电脑上是可以滚动的,但是手机不行

第二步:删除禁用触摸事件

还是源码的位置,可以看到block包裹的view有一个@touchmove.stop.prevent,这个是禁止触摸事件的,就是因为它导致的手机没法滚动,把这个删掉即可

<template><u-popup mode="bottom" :border-radius="borderRadius" :popup="false" v-model="value" :maskCloseAble="maskCloseAble"length="auto" :safeAreaInsetBottom="safeAreaInsetBottom" @close="popupClose" :z-index="uZIndex"><view class="u-tips u-border-bottom" v-if="tips.text" :style="[tipsStyle]">{{tips.text}}</view><!-- 增加个循环在block外层 --><scroll-view scroll-y style="min-height: 100rpx;max-height: 700rpx;"><block v-for="(item, index) in list" :key="index"><!-- @touchmove.stop.prevent --><view@tap="itemClick(index)":style="[itemStyle(index)]"class="u-action-sheet-item u-line-1":class="[index < list.length - 1 ? 'u-border-bottom' : '']":hover-stay-time="150"><text>{{item.text}}</text><text class="u-action-sheet-item__subtext u-line-1" v-if="item.subText">{{item.subText}}</text></view></block></scroll-view><view class="u-gab" v-if="cancelBtn"></view><view @touchmove.stop.prevent class="u-actionsheet-cancel u-action-sheet-item" hover-class="u-hover-class":hover-stay-time="150" v-if="cancelBtn" @tap="close">{{cancelText}}</view></u-popup>
</template>

vue页面

<u-action-sheet :list="list" v-model="show" @click="xxxx"></u-action-sheet>
<!-- 在data里定义list数组对象 -->

这样就可以了

http://www.dtcms.com/a/511711.html

相关文章:

  • 基于.net的个人网站开发实录哪个网站建站比较好
  • 徐州做网站公司哪家好湘建网
  • 做头发个人网站制作素材专业网站设计制作服务
  • Linux初识进程
  • c#using Oracle.ManagedDataAccess.Client 批量保存数据
  • 人大金仓数据库kingbase8创建表示例
  • oracle包编译错误
  • 函数指针 指针函数 数组指针 指针数组 常量指针 指针常量
  • sqoop采集完成后导致hdfs数据与Oracle数据量不符的问题。怎么解决?
  • 洛阳有做网站开发的吗平台网站建设源码
  • 从零开始的C++学习生活 12:AVL树全面解析
  • Spring Boot 启动慢?启动过程深度解析与优化策略
  • telnet工具使用详解
  • YOLOv4:目标检测界的 “集大成者”
  • 从零开始的C++学习生活 11:二叉搜索树全面解析
  • 【QT常用技术讲解】控件随窗口自适应变化大小或者移动位置
  • Kafka面试精讲 Day 30:Kafka面试真题解析与答题技巧
  • 江苏建设准考证打印在哪个网站医疗网站 seo怎么做
  • 数据结构9:队列
  • 逆向分析星星充电APP:从签名生成到数据深度解析
  • Vue + WebApi 实现上传下载功能
  • 建设门户网站预算做旅游网站多少钱
  • 【Rust创作】Rust 错误处理:从 panic 到优雅控制
  • 常见激活函数的Lipschitz连续证明
  • 专做皮具的网站网站建设公司排行榜
  • 第三次面试:C++实习开发
  • 公司网站内容更新该怎么做wordpress显示目录
  • 边界扫描测试原理 2 -- 边界扫描测试设备的构成
  • 如何入侵网站后台晴天影视
  • Linux top 命令使用说明