outaozhen 4 years ago
parent
commit
4891e5c938
1 changed files with 4 additions and 5 deletions
  1. 4 5
      src/pages/Hr/Notification/index.jsx

+ 4 - 5
src/pages/Hr/Notification/index.jsx

@@ -35,9 +35,8 @@ const Notification = () => {
   useEffect(() => {
     initData({ current: 1, pageSize: 10 })
   }, [])
-  // console.log(state.message.length)
   const loadMoreData = () => {
-    if (state.total === state.message.length) {
+    if (state.total === state.message?.length) {
       return
     }
     setState({
@@ -51,7 +50,7 @@ const Notification = () => {
       <h3 className="pt-5 pb-4">通知中心</h3>
       <div id="scrollableDiv" style={{ height: 700, overflow: 'auto' }}>
         <InfiniteScroll
-          dataLength={state.message.length}
+          dataLength={state.message?.length}
           next={loadMoreData}
           hasMore={state.hasMore}
           loader={<Skeleton avatar paragraph={{ rows: 1 }} active />}
@@ -66,12 +65,12 @@ const Notification = () => {
                 <List.Item.Meta
                   avatar={<Avatar src={item.avatar} />}
                   title={<a href="#">{item.title}</a>}
-                  description={[
+                  description={
                     <div className="mb-1">
                       <Tag color="purple">{msgTypeEnum[item.msgType]}</Tag> '发布于',
                       <span className="ml-2">全公司</span>
                     </div>
-                  ]}
+                  }
                 />
                 {item.content}
                 <div className="mt-1 text-hex-aaa">{item.createTime}</div>