focus-pro
Version:
focus-pro 中台前端组件库
25 lines • 755 B
JavaScript
import { CopyOutlined } from '@ant-design/icons';
import { Button, message } from 'antd';
import copy from 'copy-to-clipboard';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var Display = function Display(_ref) {
var text = _ref.text,
_ref$hide = _ref.hide,
hide = _ref$hide === void 0 ? true : _ref$hide;
var onCopy = function onCopy() {
if (text) {
copy(text);
message.success('复制成功');
}
};
return /*#__PURE__*/_jsxs("div", {
children: [hide ? '*********' : text || '-', /*#__PURE__*/_jsx(Button, {
type: "link",
size: "small",
icon: /*#__PURE__*/_jsx(CopyOutlined, {}),
onClick: onCopy
})]
});
};
export default Display;