dcloudio / dcloudio/uni-app

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

Open
#5,219 4 comments 0 reactions 1 assignee Assigned to @fxy060608 View on GitHub
Dominant language
JavaScript
Stars
41.6k
Forks
3.7k
Avg merge
7h 6m
Merged PRs (30d)
6

Description

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

> 源代码
```
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 }"
}
}
```

![1730974719167](https://github.com/user-attachments/assets/a1364846-8ccc-4720-a028-ee2505e98c3f)

产品分类: uniapp/App

PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 13.7
HBuilderX类型: 正式
HBuilderX版本号: 4.32
手机系统: Android
手机系统版本号: Android 12
手机厂商: 模拟器
手机机型: MumuPro
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.