运行dome1示例项目到Android设备时全局组件读取数据为undefined
![9***@qq.com](https://img-cdn-tc.dcloud.net.cn/account/identicon/90b2f9883e5f6901a1d793ead27ec15f.png)
- 发布:2023-03-04 17:31
- 更新:2023-03-06 17:26
- 阅读:229
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: w10
HBuilderX类型: 正式
HBuilderX版本号: 3.7.6
手机系统: Android
手机系统版本号: Android 12
手机厂商: 华为
手机机型: 荣耀,Android Studio 模拟器其他机型
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
跟h5和小程序一样正常显示
跟h5和小程序一样正常显示
实际结果:
APP Android 端数据不显示
APP Android 端数据不显示
bug描述:
运行dome1示例项目到Android设备时全局组件读取数据为undefined
服务器请示的数据返回如下:
{test: 2, res: 3, main: {remarks: "testfdsfdsfds"}}
页面代码如下,当去掉代码中加星的这行时,组件又能正常显示数据,这是什么情况
<view class="content"> <image class="logo" src="/static/logo.png"></image> <view class="text-area"> <text class="title">{{title}}</text> **<view>{{info.main.remarks}}</view>** // 去掉这行全局组件正常 </view> <test :info="info"></test> </view>
当服务器返回的数据如下
{test: 2, res: 3}
页面代码如下,组件打印{{info.res}}可以正常显示数据<view class="content"> <image class="logo" src="/static/logo.png"></image> <view class="text-area"> <text class="title">{{title}}</text> <view>{{info.res}}</view> </view> <test :info="info"></test> </view>
小结论:难道服务器只能返回{test: 2, res: 3}这种简单的数据才会正常显示数据,这不会都是这种简单的数据吧