我创建了两个项目,旧的项目中真机运行就会报错Unresolved reference: xxx
旧项目web端可以正常运行,新项目中也可以正常运行
这是uvue:
<template>
<view>
<view v-for="(item,index) in objectArray" :key="item.id">
{{index+":"+item.name}}
</view>
</view>
</template>
<script>
export default {
data () {
return {
objectArray: [{
id: 0,
name: '李强',
age:"16",
long:"160"
},{
id: 1,
name:'张三',
age:"17",
long:"170"
},{
id:2,
name:"jack",
age:"18",
long:"180"
}],
}
}
}
</script>
<style>
</style>
旧项目真机运行报错
error: Unresolved reference: id
23:44:11.569 at pages/index/home/home.uvue:3:55
23:44:11.569 1 | <template>
23:44:11.569 2 | <view>
23:44:11.569 3 | <view v-for="(item,index) in objectArray" :key="item.id">
23:44:11.569 | ^
23:44:11.569 4 | {{index+":"+item.name}}
23:44:11.569 5 | </view>
23:44:11.570 error: Unresolved reference: name
23:44:11.570 at pages/index/home/home.uvue:4:20
23:44:11.570 2 | <view>
23:44:11.570 3 | <view v-for="(item,index) in objectArray" :key="item.id">
23:44:11.570 4 | {{index+":"+item.name}}
23:44:11.570 | ^
23:44:11.570 5 | </view>
23:44:11.570 6 | </view>
2 个回复
爱豆豆 - 办法总比困难多
加上类型 试试
DCloud_UNI_yuhe
你尝试一个给objectArray指定type。