@orca-fe/pocket
Version:
UI components by orca-team
54 lines • 1.44 kB
JavaScript
var _window$publicPath;
/**
* title: Error Tips
* desc: Custom error tips with prop `errSrc`
*
* title.zh-CN: 错误提示
* desc.zh-CN: 设置 `errSrc` 属性,在图片加载失败时显示。
*/
import React from 'react';
import { Img } from "../..";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var errSrc = `${(_window$publicPath = window['publicPath']) !== null && _window$publicPath !== void 0 ? _window$publicPath : '/'}error.jpg`;
var Demo = () => /*#__PURE__*/_jsxs("div", {
children: [/*#__PURE__*/_jsx("div", {
children: "\u9ED8\u8BA4Error\u6837\u5F0F"
}), /*#__PURE__*/_jsx(Img, {
src: "err url",
style: {
width: 100,
height: 100
}
}), /*#__PURE__*/_jsx("div", {
children: "\u81EA\u5B9A\u4E49Error\u56FE\u7247"
}), /*#__PURE__*/_jsx(Img, {
src: "err url",
errSrc: errSrc,
style: {
width: 100,
height: 100
}
}), /*#__PURE__*/_jsx("div", {
children: "\u81EA\u5B9A\u4E49Error Element"
}), /*#__PURE__*/_jsx(Img, {
src: "err url",
errSrc: /*#__PURE__*/_jsx("div", {
style: {
position: 'absolute',
top: 0,
left: 0,
display: 'flex',
alignItems: 'center',
justifyItems: 'center',
height: '100%'
},
children: "Custom Error"
}),
style: {
width: 100,
height: 100
}
})]
});
export default Demo;