微信小程序,skyline引擎,display: grid失效问题解决

为了所谓的性能和自定义导航栏,选择使用skyline引擎,但它似乎对 display: grid支持的并不好,尝试了很多方法都不行,效果不理想(如果你有更好的方法,方便的话请分享给我一份,万分感谢)

最后没办法,直接用了官方推荐的grid-view,但grid-view不能拿来直接用,它需要在外层再套个scroll-view,以下代码实现了每行显示3个,但仍然有一个问题,就是它外层的scroll-view必须指定具体的高度,所以在不知道具体高度,或者不好设置固定高度的情况下,仍然还需要上其他手段,比如给scroll-view加scroll-y/scroll-x滚动条,或直接上js代码获取grid-view的尺寸,然后动态更新scroll-view的高度(我猜可以,没测试)。

html 复制代码
        <scroll-view type="custom" style="height: 240rpx;">
          <grid-view type="aligned" main-axis-gap="10" cross-axis-gap="10" cross-axis-count="3">
            <view class="grid-item" hover-class="hover-feedback-scale" bindtap="goToQuickService" data-service="duty-profile">
              <text class="grid-icon">📋</text>
              <text class="grid-name">个人档案</text>
            </view>
            <view class="grid-item" hover-class="hover-feedback-scale" bindtap="goToQuickService" data-service="duty-task">
              <text class="grid-icon">🔔</text>
              <text class="grid-name">任务提醒</text>
            </view>
            <view class="grid-item" hover-class="hover-feedback-scale" bindtap="goToQuickService" data-service="duty-checkin">
              <text class="grid-icon">✅</text>
              <text class="grid-name">签到打卡</text>
            </view>
            <view class="grid-item" hover-class="hover-feedback-scale" bindtap="goToQuickService" data-service="proposal-submit">
              <text class="grid-icon">📝</text>
              <text class="grid-name">提交议案</text>
            </view>
            <view class="grid-item" hover-class="hover-feedback-scale" bindtap="goToQuickService" data-service="proposal-query">
              <text class="grid-icon">📊</text>
              <text class="grid-name">进度查询</text>
            </view>
            <view class="grid-item" hover-class="hover-feedback-scale" bindtap="goToQuickService" data-service="internal">
              <text class="grid-icon">🔒</text>
              <text class="grid-name">内部交互</text>
            </view>
          </grid-view>
        </scroll-view>
相关推荐
show43321 小时前
多格式导出怎么做?2026免费小程序TXT/SRT实践
开发语言·小程序·c#
AI砖家1 天前
AI编程—微信小程序开发规范
微信小程序·小程序·notepad++·ai编程
show4331 天前
2026小程序端视频转文字技术对比:识别引擎精度实测
小程序·音视频
starzy19902 天前
Soloop 智能视频创作全流程实战指南
数据库·microsoft·音视频
sam-zy2 天前
微信小程序+ESP8266+Arduino 开发智能插座,有本地OTA功能
微信小程序·小程序
XUHUOJUN2 天前
Microsoft Entra Hybrid Identity Day-2 Operations 实战手册:用户、组、对象过滤、MIM 与故障排查
microsoft·microsoft 365
带娃的IT创业者2 天前
微软开源“AI Agents for Beginners”:一场面向初学者的智能体范式启蒙
人工智能·microsoft·微软·开源·react·ai智能体·初学者
A24207349302 天前
微信小程序开发:常用基础语法与指令详解
微信小程序·小程序·notepad++
黄华SJ520it2 天前
青蓝送水类型社交裂变小程序系统技术拆解
小程序·系统开发
weikecms2 天前
星巴克API接口,星巴克点餐接口开发
大数据·小程序