自定义组件报错
- Dominant language
- TypeScript
- Stars
- 18.9k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
#### 描述问题:
使用antd pro v6,使用自定义组件报错
#### 截图或视频:

#### 如何复现(请务必完整填写下面内容):
1. 你是如何使用 amis 的?
npm
2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
"amis": "^3.4.1",
4. 粘贴有问题的完整 `amis schema` 代码:
自定义组件代码,没使用decorator
```
import { Renderer } from 'amis';
import { RendererProps } from 'amis';
import React from 'react';
export interface MyRendererProps extends RendererProps {
target?: string;
}
export default Renderer({
type: 'my-renderer',
})(
class MyRenderer extends React.Component {
static defaultProps = {
target: 'world',
};
render() {
const { target } = this.props;
return
Hello {target}! @amis-editor
;}
},
);
```
tsconfig.ts
```
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"jsx": "preserve",
"esModuleInterop": true,
"sourceMap": true,
"baseUrl": "./",
"skipLibCheck": true,
"experimentalDecorators": true,
"strict": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"paths": {
"@/*": ["./src/*"],
"@@/*": ["./src/.umi/*"],
"@@test/*": ["./src/.umi-test/*"]
}
},
"include": ["./**/*.d.ts", "./**/*.ts", "./**/*.tsx"]
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the custom renderer code in the issue and its tsconfig.ts settings, then reproduce the error using antd pro v6 with amis ^3.4.1. Inspect the linked screenshot and capture the exact error and reproduction steps; done means the custom component works as intended and the regression is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100