feat: 热门关键词取去掉loading态

This commit is contained in:
zdl
2025-10-27 00:11:46 +08:00
parent b06d51813a
commit 794581e429

View File

@@ -1,6 +1,6 @@
// src/views/Community/components/PopularKeywords.js
import React, { useState, useEffect } from 'react';
import { Tag, Space, Spin, Button } from 'antd';
import { Tag, Space, Button } from 'antd';
import { useNavigate } from 'react-router-dom';
import { RightOutlined } from '@ant-design/icons';
import { logger } from '../../../utils/logger';
@@ -15,12 +15,10 @@ const DOMAIN_PREFIX = process.env.NODE_ENV === 'production'
const PopularKeywords = ({ onKeywordClick, keywords: propKeywords }) => {
const [keywords, setKeywords] = useState([]);
const [loading, setLoading] = useState(false);
const navigate = useNavigate();
// 加载热门概念涨幅前20
const loadPopularConcepts = async () => {
setLoading(true);
try {
const response = await fetch(`${API_BASE_URL}/search`, {
method: 'POST',
@@ -53,8 +51,6 @@ const PopularKeywords = ({ onKeywordClick, keywords: propKeywords }) => {
} catch (error) {
logger.error('PopularKeywords', 'loadPopularConcepts', error);
setKeywords([]);
} finally {
setLoading(false);
}
};
@@ -118,7 +114,7 @@ const PopularKeywords = ({ onKeywordClick, keywords: propKeywords }) => {
};
return (
<Spin spinning={loading}>
<>
{keywords && keywords.length > 0 && (
<div style={{ position: 'relative' }}>
<Space
@@ -199,7 +195,7 @@ const PopularKeywords = ({ onKeywordClick, keywords: propKeywords }) => {
</Button>
</div>
)}
</Spin>
</>
);
};