本人小白第一次用uniapp X的uts语法写一个列表,上来就掉坑爬不出来了,求大佬帮我看下
<template>
<scroll-view class="app-bg">
<view class="uni-margin-wrap">
<!-- <swiper id="swiper-view" class="swiper">
<swiper-item v-for="(item, index) in bannerList" :key="item.id">
<view class="swiper-item uni-bg-red">
<image class="banner-image" :src="item.url"></image>
</view>
</swiper-item>
</swiper> -->
<text v-for="(item , index) in list" :key="item.id">{{item.text}}</text>
</view>
</scroll-view>
</template>
<script setup>
const list = ref([
{
id: 1,
text: 'A'
},
{
id: 2,
text: 'B'
},
{
id: 3,
text: 'C'
}
]);
</script>
运行安卓基座,用模拟器跑,HbuilderX一直报错:error: Unresolved reference: text, Hbuilder版本是4.36,这是为什么?
2 个回复
套马杆的套子 - 没有解决不了的问题,只有解决不完的问题
这么写试试呢,我也是刚开始研究
毛毛不是泰迪
参考这个帖子的回复试试:https://ask.dcloud.net.cn/question/185726
2***@qq.com (作者)
感谢您的回复,问题已解决,必须声明类型,或者用UTSJSONObject类型
2025-01-05 13:32