alibaba / alibaba/lowcode-engine

tsx文件无法生成defaultValue

Open
#588 4 comments 0 reactions 1 assignee Claimed by @akirakai View on GitHub
enhancement
Dominant language
TypeScript
Stars
15.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

现象:使用脚手架 @alilc/element 生成的组件库项目,执行 npm run lowcode:build 后,lowcode文件夹中的代码没有defaultValue内容

步骤:
1. 使用脚手架生成组件库项目
2.在src中增加组件test.tsx,内容如下:
```
import * as React from 'react';
import { createElement } from 'react';

export interface TableProps {
id?: number;
}

const Test: React.FC = function Test({
id = 1,
}) {
return

{id}
;
};

export default Test;

```
3. 在src/index.tsx中暴露组件和type
```
export type { TestProps } from './components/test'
export { default as Test } from './components/test'
```
4.执行 npm run lowcode:build,lowcode文件夹中没有Test的defaultValue值
![image](https://user-images.githubusercontent.com/20920943/171394851-c5abf37a-a4f4-46ec-bd1e-6d41cecbb6fb.png)

5. debug @alilc/lowcode-material-parser,发现第474行,info中 id的defaultValue是null
![image](https://user-images.githubusercontent.com/20920943/171393924-8fffdedc-d9f8-4798-bf77-4a0f2f1eeb1d.png)

6. 包的版本信息
"@alib/build-scripts": "^0.1.32",
"@alifd/build-plugin-lowcode": "^0.3.0",
"name": "@alilc/lowcode-material-parser" 的版本是 "1.0.3"

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.