Browse Source

✨ feat(admin): 为合同选择组件添加样式自定义功能

- 添加style属性支持自定义组件样式
- 修改默认样式为可覆盖模式,当传入style时优先使用传入样式
yourname 8 months ago
parent
commit
5d4e4f5c79
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/client/admin/components/ContractSelect.tsx

+ 4 - 2
src/client/admin/components/ContractSelect.tsx

@@ -15,13 +15,15 @@ interface ContractSelectProps {
   onChange?: (value?: number) => void;
   onChange?: (value?: number) => void;
   placeholder?: string;
   placeholder?: string;
   disabled?: boolean;
   disabled?: boolean;
+  style?: React.CSSProperties;
 }
 }
 
 
 const ContractSelect: React.FC<ContractSelectProps> = ({
 const ContractSelect: React.FC<ContractSelectProps> = ({
   value,
   value,
   onChange,
   onChange,
   placeholder = '请选择合同',
   placeholder = '请选择合同',
-  disabled = false
+  disabled = false,
+  style,
 }) => {
 }) => {
   const [searchValue, setSearchValue] = useState('');
   const [searchValue, setSearchValue] = useState('');
 
 
@@ -66,7 +68,7 @@ const ContractSelect: React.FC<ContractSelectProps> = ({
         showSearch
         showSearch
         filterOption={false}
         filterOption={false}
         onSearch={handleSearch}
         onSearch={handleSearch}
-        style={{ width: '100%' }}
+        style={style || { width: '100%' }}
         options={options}
         options={options}
         notFoundContent={isLoading ? <Spin size="small" /> : '未找到匹配合同'}
         notFoundContent={isLoading ? <Spin size="small" /> : '未找到匹配合同'}
       />
       />