我在使用UNI-APP X +VUE3 + 该组件
当我点击一级菜单 比如 “一年级” 时报错
17:07:35.605 [Vue warn]: Invalid prop: type check failed for prop "gettreepath". Expected Object, got String with value "". \n at <UniDataPicker>\nat <View>\nat <Home>\nat <View>\nat <Index>\nat <AsyncComponentWrapper>\nat <PageBody>\nat <Page>\nat <Anonymous>\nat <KeepAlive>\nat <RouterView>\nat <Layout>\nat <App>
17:07:35.682 [Vue warn]: Invalid prop: type check failed for prop "value". Expected Object, got String with value "". \n at <UniDataPicker>\nat <View>\nat <Home>\nat <View>\nat <Index>\nat <AsyncComponentWrapper>\nat <PageBody>\nat <Page>\nat <Anonymous>\nat <KeepAlive>\nat <RouterView>\nat <Layout>\nat <App>
17:07:35.766 [Vue warn]: Invalid prop: type check failed for prop "modelValue". Expected Object, got String with value "". \n at <UniDataPicker>\nat <View>\nat <Home>\nat <View>\nat <Index>\nat <AsyncComponentWrapper>\nat <PageBody>\nat <Page>\nat <Anonymous>\nat <KeepAlive>\nat <RouterView>\nat <Layout>\nat <App>
17:07:38.340 [Vue warn]: Unhandled error during execution of native event handler \n at <ListItem>\nat <ListView>\nat <View>\nat <View>\nat <View>\nat <UniDataPicker>\nat <View>\nat <Home>\nat <View>\nat <Index>\nat <AsyncComponentWrapper>\nat <PageBody>\nat <Page>\nat <Anonymous>\nat <KeepAlive>\nat <RouterView>\nat <Layout>\nat <App>
17:07:38.345 [TypeError] {message: "nodeData.getBoolean is not a function"}
部分代码
<template>
<swiper class="container" :indicator-dots="true" :autoplay="true" :interval="3000">
<!-- 轮播图 -->
<swiper-item class="swiper-item" v-for="(item, id) in images" :key=id>
<image :src="/static/swipers/${item.name}
" mode="heightFix" class="swiper-image"></image>
</swiper-item>
</swiper>
<view class="content-box">
<uni-data-picker :localdata="items" popup-title="请选择班级" @change="onchange" ></uni-data-picker>
</view>
</template>
<script setup>
const text = ref('一年级')
const value = ref('1-0')
const items = ref([
{
text: "一年级",
value: "1-0",
children: [
{
text: "1.1班",
value: "1-1"
// 注意:如果 UTSJSONObject 有其他必填属性,你需要在这里添加它们
},
{
text: "1.2班",
value: "1-2"
// 同样,确保包含所有必填属性
}
]
},
{
text: "二年级",
value: "2-0",
// 注意:如果 children 是可选的,并且当前项没有 children,你可以省略它
},
{
text: "三年级",
value: "3-0"
}
])
const images = ref(
[{ "id": 1, name: '1.webp' },
{ "id": 2, name: '2.webp' },
{ "id": 3, name: '3.webp' },
{ "id": 4, name: '4.webp' }]
)
const onchange = (e)=> {
console.log(e)
const value = e.detail.value
}
</script>
<style lang="scss" scoped>
.content-box {
padding: 23upx 20upx 0 20upx;
.box {
padding: 25upx;
background: rgba(255, 255, 255, 1);
border-radius: 25upx;
box-shadow: 0 5upx 16upx 0 rgba(20, 104, 255, 0.07);
.box-item {
margin-top: 25upx;
position: relative;
.item-picker {
width: 100%;
margin-top: 10upx;
height: 60upx !important;
border-bottom: 2upx solid #EDEDED;
}
}
}
}
.container {
display: flex;
justify-content: center;
align-items: center;
}
.swiper-item {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.swiper-image {
width: 100%;
/* 设置为auto,因为mode为aspectFit时,宽度会根据高度和宽高比自动计算 */
}
</style>
请问错在哪儿?新手求救!