风起闲逸时
风起闲逸时
  • 发布:2025-05-22 11:40
  • 更新:2025-05-22 17:10
  • 阅读:115

【报Bug】HBuilderX更新到最新后,vue3.5.14,@vue/runtime-core也是3.5.14,动态计算高是报运行时和shared错误。

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Windows

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

第三方开发者工具版本号: 最新稳定

基础库版本号: 最新稳定

项目创建方式: CLI

CLI版本号: 最新

示例代码:
···<template> <view class="view-style" style="{width: ${props.viewWidth}rpx, height: ${props.viewHeight}rpx,
backgroundColor: props.viewBgColor}">
<uni-icons class="icon-style" fontFamily="props.iconFamily" color="props.iconColor" size="${props.iconSize}rpx"> {{ props.iconCode }}
</uni-icons>
<!--suppress TypeScriptValidateTypes -->
<input class="input-style" placeholder="props.iPlaceholder" type="props.iType" password="props.isPwd" confirm-type="props.iConfirmType"

style="{'background-color': props.iNBgColor, width: GetInputWidth}">

</input>  

</view>
</template>

<script setup lang="ts">

import {ColorVariables} from "@/common/colors/Colors.ts";  
import {computed} from "@vue/runtime-core";  

interface Props {  
    viewWidth?: number;  
    viewHeight?: number;  
    viewBgColor?: string;  
    iconCode?: string;  
    iconColor?: string;  
    iconSize?: number;  
    iconFamily?: string;  
    iPlaceholder?: string;  
    iFontFamily?: string;  
    iType?: string;  
    isPwd?: boolean;  
    iConfirmType?: string;  
    iNBgColor?: string;  
}  

let props = withDefaults(defineProps<Props>(), {  
    viewWidth: 500,  
    viewHeight: 60,  
    viewBgColor: ColorVariables.bgC3,  
    iconCode: "",  
    iconColor: ColorVariables.tC1,  
    iconSize: 30,  
    iconFamily: "iconFont",  
    iPlaceholder: "",  
    iFontFamily: "customFont",  
    iType: "text",  
    isPwd: false,  
    iConfirmType: "text",  
    iNBgColor: ColorVariables.bgC5,  
});  

let GetInputWidth = computed<string>(() =>  
{  
    return props.viewWidth - (10 + props.iconSize + 8) - 20 + 'rpx';  
});  

</script>

<style scoped lang="less">
@import "@/Style.less";

.view-style  
{  
    display: flex;  
    border: 2rpx solid @bL1;  
    border-radius: 10rpx;  
    align-items: center;  
}  

/* #ifndef MP-WEIXIN */  
.icon-style  
{  
    margin-left: 10rpx;  
}  
/* #endif */  
/* 微信小程序专用样式 */  
/* #ifdef MP-WEIXIN */  
.icon-style  
{  
    margin-left: 10rpx;  
    margin-bottom: 5rpx;  
}  
/* #endif */  

.input-style  
{  
    margin-left: 8rpx;  
    margin-top: 5rpx;  
}  

</style>
···

操作步骤:

vue使用3.5.14,@vue/runtime-core也是3.5.14,微信小程序,动态计算input的款度时报该错误。在“:style="{'background-color': props.iNBgColor, width: GetInputWidth}” 这行代码红使用GetInputWidth动态计算宽度时,编译报错

预期结果:

正常计算出高度

实际结果:

编译时报该错误

bug描述:

node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js (8:293): "getEscapedCssVarName" is not exported by "node_modules/@vue/shared/dist/shared.esm-bundler.js", imported by "node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js".
file: E:/HBuilderXWorkspace/xinyi-app/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:8:293

2025-05-22 11:40 负责人:无 分享
已邀请:
DCloud_UNI_JBB

DCloud_UNI_JBB

vue的版本使用 3.4.21呢?和uniapp内部的vue版本保持一致,看下还有没有问题

  • 风起闲逸时 (作者)

    有问题

    2025-05-22 13:35

  • DCloud_UNI_JBB

    回复 z***@foxmail.com: 发个可复现demo

    2025-05-22 14:39

  • 风起闲逸时 (作者)

    回复 DCloud_UNI_JBB: 我重新建一个项目 按照你说调成3.4.21 小程序是可以了 但是运行到安卓模拟器又不可以了,进去直接白屏也不报错。我模拟器用的mumu4.1.25

    2025-05-22 17:07

  • 风起闲逸时 (作者)

    我把项目压缩上传到附件上面了

    2025-05-22 17:09

风起闲逸时

风起闲逸时 (作者) - 风起闲逸时

demo

  • DCloud_UNI_JBB

    发不到你发的附件

    2025-05-22 17:27

  • 风起闲逸时 (作者)

    回复 DCloud_UNI_JBB: 不知道是不是我的写法错误,我把那个计算款度的函数去掉 computed 貌似也可以,我就这样修改了

    2025-05-22 17:34

  • 风起闲逸时 (作者)

    回复 DCloud_UNI_JBB: 不知道为啥 我附件上传不上去

    2025-05-22 17:46

  • DCloud_UNI_JBB

    回复 z***@foxmail.com: 附件可以通过im发给我

    2025-05-22 18:00

  • 风起闲逸时 (作者)

    回复 DCloud_UNI_JBB:怎么发?你给我一个你的地址 我没有找到地址

    2025-05-22 19:12

  • DCloud_UNI_JBB

    回复 z***@foxmail.com: https://im.dcloud.net.cn/index.html#/ 这里

    2025-05-22 19:15

  • DCloud_UNI_JBB

    搜索我的名字

    2025-05-22 19:16

要回复问题请先登录注册