feat: 增加多城市组件
parent
7cce92adea
commit
12208202ad
@ -0,0 +1,29 @@
|
||||
import { createContext, useEffect, useState } from 'react';
|
||||
import {} from 'antd';
|
||||
import SearchInput from './SearchInput';
|
||||
import { fetchJSON } from '@/utils/request';
|
||||
import { HT_HOST } from '@/config';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
//供应商列表
|
||||
export const fetchCityList = async (q) => {
|
||||
const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/search_cities`, { q });
|
||||
return errcode !== 0 ? [] : result;
|
||||
};
|
||||
|
||||
const MultiCitySelector = ({ ...props }) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<>
|
||||
<SearchInput
|
||||
placeholder={t('products:City')}
|
||||
mode={null}
|
||||
maxTagCount={0}
|
||||
{...props}
|
||||
fetchOptions={fetchCityList}
|
||||
map={{ city_name: 'label', city_id: 'value' }}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default MultiCitySelector;
|
Loading…
Reference in New Issue