Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
159b3e6d
Commit
159b3e6d
authored
Jul 26, 2024
by
李纪文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 缺省页增加图片默认取值路径
parent
8b6816e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
index.js
packages/base-components/Empty/src/index.js
+17
-2
index.less
packages/base-components/Empty/src/index.less
+8
-0
No files found.
packages/base-components/Empty/src/index.js
View file @
159b3e6d
...
...
@@ -9,7 +9,7 @@
import
React
,
{
useContext
}
from
'react'
;
import
classNames
from
'classnames'
;
import
PropTypes
from
'prop-types'
;
import
{
ConfigProvider
}
from
'antd'
;
import
{
ConfigProvider
,
Image
}
from
'antd'
;
import
noDataLight
from
'./assets/noDataLight.png'
;
import
noDataDark
from
'./assets/noDataDark.png'
;
import
errorLight
from
'./assets/errorLight.png'
;
...
...
@@ -22,6 +22,7 @@ const Empty = ({ description, image, theme, size, statusCode, imageStyle, childr
const
des
=
description
||
DESC_DATA
[
`
${
statusCode
}
`
];
// eslint-disable-next-line no-use-before-define
const
imageSrc
=
image
||
IMAGE_DATA
[
theme
][
statusCode
==
'0'
?
0
:
1
];
const
defaultSrc
=
image
||
IMAGE_DATA_DEFAULT
[
theme
][
statusCode
==
'0'
?
0
:
1
];
const
{
getPrefixCls
}
=
useContext
(
ConfigProvider
.
ConfigContext
);
const
prefixCls
=
getPrefixCls
(
'panda-empty'
);
...
...
@@ -29,7 +30,16 @@ const Empty = ({ description, image, theme, size, statusCode, imageStyle, childr
let
imageNode
=
null
;
if
(
typeof
image
===
'string'
)
{
imageNode
=
<
img
alt
=
{
alt
}
src
=
{
imageSrc
}
/>
;
imageNode
=
<
Image
rootClassName
=
{
`
${
prefixCls
}
-image-nodebox`
}
alt
=
{
alt
}
src
=
{
defaultSrc
}
fallback
=
{
imageSrc
}
preview
=
{
false
}
onError
=
{(
e
)
=>
{
if
(
window
.
__POWERED_BY_QIANKUN__
)
console
.
clear
();
}}
/>
;
}
else
{
imageNode
=
image
;
}
...
...
@@ -81,3 +91,8 @@ const IMAGE_DATA = {
light
:
[
noDataLight
,
errorLight
],
dark
:
[
noDataDark
,
errorDark
],
};
const
IMAGE_DATA_DEFAULT
=
{
light
:
[
'/iconlibrary/empty/noDataLight.png'
,
'/iconlibrary/empty/errorLight.png'
],
dark
:
[
'/iconlibrary/empty/noDataDark.png'
,
'/iconlibrary/empty/errorDark.png'
],
};
packages/base-components/Empty/src/index.less
View file @
159b3e6d
...
...
@@ -8,6 +8,14 @@
&-image {
margin-bottom: 10px;
&-nodebox {
height: 100%;
img {
width: auto;
}
}
img {
height: 100%;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment