File path invalid 页面加载出错,进入match页面空白。
特意做了一个简化版的match.js还是报错,代码如下:
// match.js - 最小可执行版本
Page({
data: {
matchId: '',
scoreA: 0,
scoreB: 0,
teamAName: '红队',
teamBName: '蓝队',
matchLoaded: true,
loadError: false
},
onLoad: function(options) {
console.log('页面加载参数:', options);
// 从参数获取比赛ID
const matchId = options.id || '未知ID';
// 直接设置静态数据
this.setData({
matchId: matchId,
scoreA: 10,
scoreB: 8
});
},
// 返回首页
navigateBack: function() {
wx.navigateBack({
fail: function() {
wx.reLaunch({
url: '/pages/index/index'
});
}
});
}
});
match.wxml内容:
<!--match.wxml - 极简版-->
<view class="container">
<!-- 返回按钮 -->
<view class="nav-bar">
<view class="back-btn" bindtap="navigateBack">返回</view>
</view>
<!-- 比赛ID -->
<view class="match-id">
<text>比赛ID: {{matchId}}</text>
</view>
<!-- 比分显示 -->
<view class="score-board">
<!-- 队伍A -->
<view class="team">
<view class="team-name">{{teamAName}}</view>
<view class="score">{{scoreA}}</view>
</view>
<!-- 分隔符 -->
<view class="separator">:</view>
<!-- 队伍B -->
<view class="team">
<view class="team-name">{{teamBName}}</view>
<view class="score">{{scoreB}}</view>
</view>
</view>
</view>
match.wxss内容:
/* match.wxss - 极简版 */
.container {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
background-color: #fff;
min-height: 100vh;
}
.nav-bar {
display: flex;
width: 100%;
padding: 10px;
margin-bottom: 20px;
}
.back-btn {
padding: 5px 10px;
background-color: #f0f0f0;
border-radius: 5px;
}
.match-id {
margin-bottom: 30px;
font-size: 16px;
}
.score-board {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.team {
display: flex;
flex-direction: column;
align-items: center;
margin: 0 20px;
}
.team-name {
font-size: 20px;
margin-bottom: 10px;
}
.score {
font-size: 60px;
font-weight: bold;
}
.separator {
font-size: 40px;
margin: 0 10px;
}
真机调试报错,包括开发板,体验版:
