fix: Cursor CLI 优化微信小程序兼容性和健壮性

- 添加 scrollViewHeight 明确 scroll-view 高度,修复部分机型滚动失效
- 跳转营养素详情时使用 encodeURIComponent 编码中文参数
- 修复代码风格(补充分号)

由 Cursor CLI (agent) 自动检测并修复
This commit is contained in:
2026-03-05 11:02:09 +08:00
parent 50d5b7ebf9
commit a02529acba

View File

@@ -25,8 +25,8 @@
</view> </view>
</view> </view>
<!-- 内容区域 --> <!-- 内容区域微信小程序要求 scroll-view 有明确高度 -->
<scroll-view class="content-scroll" scroll-y> <scroll-view class="content-scroll" scroll-y :style="{ height: scrollViewHeight }">
<!-- 营养素百科Tab内容 --> <!-- 营养素百科Tab内容 -->
<view v-if="currentTab === 'nutrients'" class="tab-content"> <view v-if="currentTab === 'nutrients'" class="tab-content">
<view class="intro-text">了解关键营养素科学管理慢性肾病饮食</view> <view class="intro-text">了解关键营养素科学管理慢性肾病饮食</view>
@@ -128,6 +128,7 @@ export default {
data() { data() {
return { return {
currentTab: 'nutrients', currentTab: 'nutrients',
scrollViewHeight: 'calc(100vh - 120rpx)', // 为 tab 预留高度,微信小程序 scroll-view 需明确高度
guideList: [], guideList: [],
articleList: [], articleList: [],
nutrientList: [ nutrientList: [
@@ -268,8 +269,8 @@ export default {
const item = this.nutrientList[index]; const item = this.nutrientList[index];
if (!item) return; if (!item) return;
uni.navigateTo({ uni.navigateTo({
url: `/pages/tool/nutrient-detail?name=${item.name}` url: `/pages/tool/nutrient-detail?name=${encodeURIComponent(item.name)}`
}) });
}, },
goToDetail(event) { goToDetail(event) {
const id = event.currentTarget.dataset.itemId; const id = event.currentTarget.dataset.itemId;