@schema-render/form-render-react
Version:
Out-of-the-box form rendering library based on Core and Antd.
16 lines (15 loc) • 471 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Switch as AntSwitch } from "antd";
import React from "react";
const Switch = ({ schema, disabled, readonly, value, onChange })=>{
return /*#__PURE__*/ _jsx(AntSwitch, {
...schema.renderOptions,
checked: value,
onChange: (val)=>onChange(val),
// 禁用态、只读态都表现为禁用
disabled: disabled || readonly
});
};
export default {
component: Switch
};