fix: Cursor CLI 优化微信小程序兼容性和健壮性
- 添加 scrollViewHeight 明确 scroll-view 高度,修复部分机型滚动失效 - 跳转营养素详情时使用 encodeURIComponent 编码中文参数 - 修复代码风格(补充分号) 由 Cursor CLI (agent) 自动检测并修复
This commit is contained in:
@@ -25,8 +25,8 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<scroll-view class="content-scroll" scroll-y>
|
||||
<!-- 内容区域(微信小程序要求 scroll-view 有明确高度) -->
|
||||
<scroll-view class="content-scroll" scroll-y :style="{ height: scrollViewHeight }">
|
||||
<!-- 营养素百科Tab内容 -->
|
||||
<view v-if="currentTab === 'nutrients'" class="tab-content">
|
||||
<view class="intro-text">了解关键营养素,科学管理慢性肾病饮食</view>
|
||||
@@ -128,6 +128,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
currentTab: 'nutrients',
|
||||
scrollViewHeight: 'calc(100vh - 120rpx)', // 为 tab 预留高度,微信小程序 scroll-view 需明确高度
|
||||
guideList: [],
|
||||
articleList: [],
|
||||
nutrientList: [
|
||||
@@ -268,8 +269,8 @@ export default {
|
||||
const item = this.nutrientList[index];
|
||||
if (!item) return;
|
||||
uni.navigateTo({
|
||||
url: `/pages/tool/nutrient-detail?name=${item.name}`
|
||||
})
|
||||
url: `/pages/tool/nutrient-detail?name=${encodeURIComponent(item.name)}`
|
||||
});
|
||||
},
|
||||
goToDetail(event) {
|
||||
const id = event.currentTarget.dataset.itemId;
|
||||
|
||||
Reference in New Issue
Block a user