refactor: improve linkage rule enable (#1700)
This commit is contained in:
parent
76faa9e30c
commit
e8bb962389
@ -74,6 +74,8 @@ export default {
|
||||
"Value":"Value",
|
||||
"Disabled":"Disabled",
|
||||
"Enabled":"Enabled",
|
||||
'On':'On',
|
||||
'Off':'Off',
|
||||
"Empty":"Empty",
|
||||
"Linkage rule":"Linkage rule",
|
||||
"Linkage rules":"Linkage rules",
|
||||
|
@ -79,6 +79,8 @@ export default {
|
||||
"Value":"フィールド値",
|
||||
"Disabled":"無効化",
|
||||
"Enabled":"有効化",
|
||||
'On':'有効化',
|
||||
'Off':'無効化',
|
||||
"Empty":"くうきち",
|
||||
"Linkage rule":"連動規則",
|
||||
"Linkage rules":"連動規則",
|
||||
|
@ -41,6 +41,8 @@ export default {
|
||||
"Setting": "设置",
|
||||
"Enable": "启用",
|
||||
"Disable": "禁用",
|
||||
'On':'启用',
|
||||
'Off':'禁用',
|
||||
"Logo": "Logo",
|
||||
"Add menu item": "添加菜单项",
|
||||
"Page": "页面",
|
||||
|
@ -1,13 +1,18 @@
|
||||
import React from 'react';
|
||||
import { Switch } from 'antd';
|
||||
import { ArrayBase } from '@formily/antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const EnableLinkage = React.forwardRef((props: any, ref) => {
|
||||
const array = ArrayBase.useArray();
|
||||
const index = ArrayBase.useIndex(props.index);
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Switch
|
||||
{...props}
|
||||
checkedChildren={t('On')}
|
||||
unCheckedChildren={t('Off')}
|
||||
checked={!array?.field?.value[index].disabled}
|
||||
size={'small'}
|
||||
style={{
|
||||
|
Loading…
Reference in New Issue
Block a user