ZIndex9999
ZIndex9999
  • 发布:2025-01-28 21:35
  • 更新:2025-01-28 21:35
  • 阅读:26

uniapp x开发报错io.dcloud.uniapp.vue.UTSReactiveJSONObject cannot be cast to uni.UNIEF954BF.Tag‌

分类:uni-app x

21:28:00.467 ‌error: java.lang.ClassCastException: io.dcloud.uniapp.vue.UTSReactiveJSONObject cannot be cast to uni.UNIEF954BF.Tag‌
21:28:00.467 at pages/add-diary/add-diary.uvue:22:6
21:28:00.467 20 | <image src="/static/images/tag.png" class="tag-icon" ></image>
21:28:00.467 21 | <text class="page-header-date" style="margin-top: 8px;" @click="jumpTag">标签:</text>
21:28:00.467 22 | <text v-for="(item,index) in tagList" :key="index" class='tag-item'>{{1}}</text>
21:28:00.467 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21:28:00.467 23 |
21:28:00.467 24 | </view>

onLoad() {
this.detailedDate = this.getFormattedDate()
const res = uni.getStorageSync('today_record_tags')
console.log('Storage',res,res instanceof UTSArray<Tag>)
if(res instanceof UTSArray<Tag>){
this.tagList = res as Array<Tag>
}

    },  

编译器 打印的
21:28:01.203 Storage ‍[Array]‍ [ {isChecked: true, label: "兴奋"}, {isChecked: true, label: "惊喜"}, {isChecked: true, label: "焦虑"}, {isChecked: true, label: "失望"} ] [boolean] true at pages/add-diary/add-diary.uvue:99

export default {
data() {
return{
tagList: [] as Tag[],
}
}
}

2025-01-28 21:35 负责人:无 分享
已邀请:

要回复问题请先登录注册