Commit c4da5f68 authored by XieZhiXiong's avatar XieZhiXiong

feat: 获取更多额外属性

parent c5943094
......@@ -13,9 +13,10 @@ interface SmilingFaceProps {
value: number;
};
const SmilingFace: React.FC<SmilingFaceProps> = ({
value,
}) => {
const SmilingFace = (props) => {
const { value, schema } = props
const componentProps = schema?.getExtendsComponentProps() || {};
let node = null;
switch (value) {
......@@ -23,20 +24,20 @@ const SmilingFace: React.FC<SmilingFaceProps> = ({
case 1:
case 2: {
node = (
<>
<div {...componentProps}>
<Mood type="sad" customStyle={{ marginRight: 8 }} />
<span>{intl.formatMessage({id: 'components.chaping'})}</span>
</>
</div>
);
break;
}
case 3: {
node = (
<>
<div {...componentProps}>
<Mood type="notBad" customStyle={{ marginRight: 8 }} />
<span>{intl.formatMessage({id: 'components.zhongping'})}</span>
</>
</div>
);
break;
}
......@@ -44,10 +45,10 @@ const SmilingFace: React.FC<SmilingFaceProps> = ({
case 4:
case 5: {
node = (
<>
<div {...componentProps}>
<Mood type="smile" customStyle={{ marginRight: 8 }} />
<span>{intl.formatMessage({id: 'components.haoping'})}</span>
</>
</div>
);
break;
}
......@@ -58,4 +59,6 @@ const SmilingFace: React.FC<SmilingFaceProps> = ({
return node;
};
SmilingFace.isFieldComponent = true;
export default SmilingFace;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment