You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dashboard/src/components/search/SiteSelect.jsx

39 lines
1.2 KiB
React

3 years ago
import React, {Component} from 'react';
import {Select} from 'antd';
import {observer} from 'mobx-react';
import { sites } from '../../libs/ht';
3 years ago
class SiteSelect extends Component {
constructor(props) {
super(props);
}
render() {
const { store, mode, value, onChange, show_all, ...extProps } = this.props;
3 years ago
return (
<div>
<Select
mode={mode || store?.site_select_mode || null}
style={{width: '100%'}}
placeholder="选择来源"
defaultValue={value || store?.webcode || 'ALL'}
onChange={(value) => {
if (typeof onChange === 'function') {
onChange(value);
}
store?.handleChange_webcode(value);
}}
{...extProps}
3 years ago
>
{show_all===true ? <Select.Option key="1" value="ALL">所有来源</Select.Option> : ''}
{sites.map(ele => <Select.Option key={ele.key} value={ele.code}>{ele.label}</Select.Option>)}
3 years ago
</Select>
</div>
);
}
}
3 years ago
export default observer(SiteSelect);