1***@163.com
1***@163.com
  • 发布:2025-06-02 17:19
  • 更新:2025-06-03 15:34
  • 阅读:86

【报Bug】使用uni-list插件,编译过程中uni-badge报错

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 11

HBuilderX类型: 正式

HBuilderX版本号: 4.66

手机系统: Android

手机系统版本号: Android 12

手机厂商: 华为

手机机型: 11

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

<template>
<CommonContainer>
<CommonBackViewUvue v-bind:title="title" v-bind:src="backSrc"></CommonBackViewUvue>
<uni-list>
<uni-list-item title="列表左侧带略缩图" note="列表描述信息"
thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png" thumb-size="lg"
rightText="右侧文字"></uni-list-item>
<uni-list-item :show-extra-icon="true" :extra-icon="extraIcon1" title="列表左侧带扩展图标"></uni-list-item>
</uni-list>
</CommonContainer>
</template>

<script>
import CommonBackViewUvue from '../../components/CommonBackView.uvue';
type Item = {
algorithmTitle : string,
reginTitle : string,
sameTitle : string,
channelTitle : string,
channelOneText : string,
channelTwoText : string,
channelThreeText : string,
channelFourText : string,
snapImage : string,
snapBtnText : string,
samePercentageOne : string,
samePercentageTwo : string,
samePercentageThree : string,
samePercentageFour : string,
btnConfirmText : string
}
export default {
components: {
CommonBackViewUvue
},

    data() {  
        return {  
            title: "抓拍设置",  
            backSrc: '/static/icon_back.png',  
            listData: [{  
                algorithmTitle: "算法使能",  
                reginTitle: "区域设置",  
                sameTitle: '识别相似度',  
                channelTitle: "通道1",  
                channelOneText: "1",  
                channelTwoText: "2",  
                channelThreeText: "3",  
                channelFourText: "4",  
                snapImage: "",  
                snapBtnText: "抓拍",  
                samePercentageOne: "20%",  
                samePercentageTwo: "20%",  
                samePercentageThree: "20%",  
                samePercentageFour: "20%",  
                btnConfirmText: "确定"  
            },  
            {  
                algorithmTitle: "算法使能",  
                reginTitle: "区域设置",  
                sameTitle: '识别相似度',  
                channelTitle: "通道2",  
                channelOneText: "1",  
                channelTwoText: "2",  
                channelThreeText: "3",  
                channelFourText: "4",  
                snapImage: "",  
                snapBtnText: "抓拍",  
                samePercentageOne: "20%",  
                samePercentageTwo: "20%",  
                samePercentageThree: "20%",  
                samePercentageFour: "20%",  
                btnConfirmText: "确定"  
            },  
            {  
                algorithmTitle: "算法使能",  
                reginTitle: "区域设置",  
                sameTitle: '识别相似度',  
                channelTitle: "通道3",  
                channelOneText: "1",  
                channelTwoText: "2",  
                channelThreeText: "3",  
                channelFourText: "4",  
                snapImage: "",  
                snapBtnText: "抓拍",  
                samePercentageOne: "20%",  
                samePercentageTwo: "20%",  
                samePercentageThree: "20%",  
                samePercentageFour: "20%",  
                btnConfirmText: "确定"  
            },  
            {  
                algorithmTitle: "算法使能",  
                reginTitle: "区域设置",  
                sameTitle: '识别相似度',  
                channelTitle: "通道4",  
                channelOneText: "1",  
                channelTwoText: "2",  
                channelThreeText: "3",  
                channelFourText: "4",  
                snapImage: "",  
                snapBtnText: "抓拍",  
                samePercentageOne: "20%",  
                samePercentageTwo: "20%",  
                samePercentageThree: "20%",  
                samePercentageFour: "20%",  
                btnConfirmText: "确定"  
            }  
            ] as Item[]  
        }  
    },  
    methods: {  

    }  
}  

</script>

<style>

</style>

操作步骤:

自建的uni-app x 项目 在下载uni-modules插件后,在uni.scss顶部引用依赖;在uvue页面使用uni-list 然后 编译过程中依赖的uni-bage报错

预期结果:

预期结果是使用的官方插件,应该是能够正常运行的。

实际结果:

编译过程中,代码推断类型报错

bug描述:

uni-app x 使用uni-list的时候依赖uni-badge 报错

[plugin:uni:app-uts] 编译失败
17:12:05.207 ‌error: Unresolved reference: extraIcon1‌
17:12:05.207 at pages/snap/SnapSetting.uvue:8:55
17:12:05.208 6 | thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png" thumb-size="lg"
17:12:05.208 7 | rightText="右侧文字"></uni-list-item>
17:12:05.208 8 | <uni-list-item :show-extra-icon="true" :extra-icon="extraIcon1" title="列表左侧带扩展图标"></uni-list-item>
17:12:05.208 | ^
17:12:05.208 9 | </uni-list>
17:12:05.208 10 | </CommonContainer>
17:12:05.208 ‌error: Unresolved reference: dotStyle‌
17:12:05.208 at uni_modules/uni-badge/components/uni-badge/uni-badge.vue:4:77
17:12:05.208 2 | <view class="uni-badge--x">
17:12:05.208 3 | <slot />
17:12:05.208 4 | <text v-if="text" :class="classNames" :style="[positionStyle, customStyle, dotStyle]"
17:12:05.208 | ^
17:12:05.208 5 | class="uni-badge" @click="onClick()">{{displayValue}}</text>
17:12:05.208 6 | </view>
17:12:05.208 ‌error: None of the following functions can be called with the arguments supplied: ‌
17:12:05.208 ‌public inline fun String(stringBuffer: StringBuffer): String defined in kotlin.text‌
17:12:05.208 ‌public inline fun String(stringBuilder: StringBuilder): String defined in kotlin.text‌
17:12:05.208 ‌public inline fun String(bytes: ByteArray): String defined in kotlin.text‌
17:12:05.208 ‌public inline fun String(chars: CharArray): String defined in kotlin.text‌
17:12:05.208 at uni_modules/uni-badge/components/uni-badge/uni-badge.vue:85:11
17:12:05.208 83 | computed: {
17:12:05.209 84 | width() {
17:12:05.209 85 | return String(this.text).length * 8 + 12
17:12:05.209 | ^
17:12:05.209 86 | },
17:12:05.209 87 | classNames() {
17:12:05.209 ‌error: 类型不匹配: 推断类型是String,但预期的是Boolean。‌
17:12:05.209 at uni_modules/uni-badge/components/uni-badge/uni-badge.vue:98:5
17:12:05.209 96 | 'uni-badge--' + type,
17:12:05.209 97 | 'uni-badge--' + size,
17:12:05.209 98 | absolute ? 'uni-badge--absolute' : ''
17:12:05.209 | ^
17:12:05.209 99 | ].join(' ')
17:12:05.209 100| },
17:12:05.209 ‌error: Unresolved reference: !‌
17:12:05.209 at uni_modules/uni-badge/components/uni-badge/uni-badge.vue:102:9
17:12:05.209 100| },
17:12:05.209 101| positionStyle() {
17:12:05.209 102| if (!this.absolute) return {}
17:12:05.209 | ^
17:12:05.209 103| let w = this.width / 2,
17:12:05.209 104| h = 10

2025-06-02 17:19 负责人:无 分享
已邀请:
DCloud_UNI_JBB

DCloud_UNI_JBB

目前只有部分uni-ui组件支持了uniapp-x,如果有些组件报错了,你可以先尝试自己修改下,或者插件市场里寻找那些支持 uniapp-x的组件库。

要回复问题请先登录注册