feat(platform): resolve vehicle identity before navigation
This commit is contained in:
@@ -41,10 +41,11 @@ export function AppShell({
|
||||
activePage: PageKey;
|
||||
linkIssueCount: number | null;
|
||||
onChange: (page: PageKey) => void;
|
||||
onVehicleSearch: (keyword: string) => void;
|
||||
onVehicleSearch: (keyword: string) => void | Promise<void>;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const [keyword, setKeyword] = useState('');
|
||||
const [searching, setSearching] = useState(false);
|
||||
|
||||
const search = () => {
|
||||
const value = keyword.trim();
|
||||
@@ -52,7 +53,8 @@ export function AppShell({
|
||||
Toast.warning('请输入 VIN / 车牌 / 手机号');
|
||||
return;
|
||||
}
|
||||
onVehicleSearch(value);
|
||||
setSearching(true);
|
||||
Promise.resolve(onVehicleSearch(value)).finally(() => setSearching(false));
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -81,7 +83,7 @@ export function AppShell({
|
||||
onEnterPress={search}
|
||||
style={{ width: 320 }}
|
||||
/>
|
||||
<Button theme="solid" type="primary" onClick={search}>查询车辆</Button>
|
||||
<Button theme="solid" type="primary" loading={searching} onClick={search}>查询车辆</Button>
|
||||
</Space>
|
||||
<Space spacing={12}>
|
||||
<Tag color="blue">生产环境</Tag>
|
||||
|
||||
Reference in New Issue
Block a user