diff --git a/packages/vant/src/empty/Empty.tsx b/packages/vant/src/empty/Empty.tsx index aa2531bfd..f996ad771 100644 --- a/packages/vant/src/empty/Empty.tsx +++ b/packages/vant/src/empty/Empty.tsx @@ -5,7 +5,7 @@ import { makeStringProp, createNamespace, } from '../utils'; -import { renderNetwork, renderMaterial } from './Images'; +import { renderNetwork, renderMaterial, renderError } from './Images'; const [name, bem] = createNamespace('empty'); @@ -38,6 +38,9 @@ export default defineComponent({ if (image === 'default') { return renderMaterial(); } + if (image === 'error') { + return renderError(); + } if (PRESET_IMAGES.includes(image)) { image = `https://img.yzcdn.cn/vant/empty-image-${image}.png`; diff --git a/packages/vant/src/empty/Images.tsx b/packages/vant/src/empty/Images.tsx index eebe5a34d..ccd19d890 100644 --- a/packages/vant/src/empty/Images.tsx +++ b/packages/vant/src/empty/Images.tsx @@ -19,6 +19,21 @@ const renderCloudDef = () => ( ); +const renderShadowRef = () => ( + + + + +); + const renderBuilding = () => ( @@ -39,6 +54,10 @@ const renderCloud = () => ( ); +const renderShadow = () => ( + +); + export const renderNetwork = () => ( @@ -134,3 +153,24 @@ export const renderMaterial = () => ( ); + +export const renderError = () => ( + + + {renderBuildingDef()} + {renderCloudDef()} + {renderShadowRef()} + + {renderStop('#F2F3F5', 0)} + {renderStop('#DCDEE0', 100)} + + + {renderBuilding()} + {renderCloud()} + {renderShadow()} + + +); diff --git a/packages/vant/src/empty/test/__snapshots__/demo.spec.ts.snap b/packages/vant/src/empty/test/__snapshots__/demo.spec.ts.snap index 3225d70b2..b648a395f 100644 --- a/packages/vant/src/empty/test/__snapshots__/demo.spec.ts.snap +++ b/packages/vant/src/empty/test/__snapshots__/demo.spec.ts.snap @@ -227,7 +227,106 @@ exports[`should render demo and match snapshot 1`] = ` >
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Description