UNPKG

yzsd

Version:
34 lines 1.35 kB
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; /** * title: 基本 * description: 通过 `notification.useNotification` 创建支持读取 context 的 `contextHolder`。请注意,我们推荐通过顶层注册的方式代替 `message` 静态方法,因为静态方法无法消费上下文,因而 ConfigProvider 的数据也不会生效。 */ import React from 'react'; import { Notification as useNotification, Button } from 'yzsd'; var App = function App() { var _useNotification = useNotification({ closable: true }), _useNotification2 = _slicedToArray(_useNotification, 2), notice = _useNotification2[0], holder = _useNotification2[1]; return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, { type: 'primary', onClick: function onClick() { notice.open({ placement: 'topLeft', duration: null, content: "".concat(new Date(), "-").concat(new Date(), "-").concat(new Date()) }); } }, "topLeft"), /*#__PURE__*/React.createElement(Button, { onClick: function onClick() { notice.open({ placement: 'topRight', duration: null, content: "".concat(new Date(), "-").concat(new Date(), "-").concat(new Date()) }); } }, "topRight"), holder); }; export default App;