清霆
清霆
  • 发布:2024-11-07 18:21
  • 更新:2024-11-08 18:04
  • 阅读:93

【报Bug】代码里定义的变量里的数据在获取的时候被强制转换了

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

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

HBuilderX类型: 正式

HBuilderX版本号: 4.32

手机系统: Android

手机系统版本号: Android 12

手机厂商: 模拟器

手机机型: MumuPro

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
export const test = {  
  type: 'JSFunction',  
  value: "function () {\n    console.log('did mount');\n  }",  
  value2: 'console.log',  
  value3: "console.log('das')",  
  mounted: {  
    type: 'JSFunction',  
    value: "function () {\n    console.log('did mount');\n  }"  
  },  
  lifeCycles: {  
    mounted: {  
      type: 'JSFunction',  
      value: "function () {\n    console.log('did mount');\n  }",  
      mounted2: {  
        type: 'JSFunction',  
        value: "function () {\n    console.log('did mount');\n  }"  
      }  
    },  
    beforeMount: {  
      type: 'JSFunction',  
      value: "function () {\n    console.log('will unmount');\n  }"  
    },  
    beforeDestroy: {  
      type: 'JSFunction',  
      value: "function () {\n    console.log('will unmount');\n  }"  
    }  
  }  
};

操作步骤:

定义变量,使用变量

预期结果:

正确获取变量数据

实际结果:

没有正确获取变量数据

bug描述:

代码里定义的变量里的数据在获取的时候被强制转换了

export const test = {    
    mounted: {    
      type: 'JSFunction',    
      value: "function () {\n    console.log('did mount');\n  }",    
      mounted2: {    
        type: 'JSFunction',    
        value: "function () {\n    console.log('did mount');\n  }"    
      }    
    },    
    beforeMount: {    
      type: 'JSFunction',    
      value: "function () {\n    console.log('will unmount');\n  }"    
    },    
    beforeDestroy: {    
      type: 'JSFunction',    
      value: "function () {\n    console.log('will unmount');\n  }"    
    }    
};

获取的时候变成了:

{  
    "mounted": {  
        "type": "JSFunction",  
        "value": "function () {\n    __f__('log','at pages/home/data-source.ts:54','did mount');\n  }"  
    },  
    "beforeMount": {  
        "type": "JSFunction",  
        "value": "function () {\n    __f__('log','at pages/home/data-source.ts:58','will unmount');\n  }"  
    },  
    "beforeDestroy": {  
        "type": "JSFunction",  
        "value": "function () {\n    __f__('log','at pages/home/data-source.ts:62','will unmount');\n  }"  
    }  
}
2024-11-07 18:21 负责人:无 分享
已邀请:
清霆

清霆 (作者)

@DCloud_HB_WJ @DCloud_UNI_yuhe @DCloud-HBuilderX团队

要回复问题请先登录注册