@ecoding/components.antd 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,7 +34,6 @@ class InjectNotification extends React.Component {
34
34
  }
35
35
  else {
36
36
  const temp = notices.splice(index, 1);
37
- console.log(notices.concat(temp));
38
37
  this.setState(Object.assign({}, {
39
38
  notices: notices.concat(temp),
40
39
  }));
@@ -32,9 +32,6 @@ LoadingFC.defaultProps = {
32
32
  };
33
33
  export default {
34
34
  show(props = {}) {
35
- if (notification) {
36
- notification.removeNotice('loading');
37
- }
38
35
  notification.notice(React.createElement(LoadingFC, Object.assign({}, props, { key: "loading" })));
39
36
  },
40
37
  hide(props = {}) {
@@ -62,7 +62,9 @@ const show = (props = {}) => {
62
62
  if (notification) {
63
63
  notification.removeNotice('toast');
64
64
  }
65
- notification.notice(React.createElement(ToastFC, Object.assign({}, props, { key: "toast" })));
65
+ setTimeout(() => {
66
+ notification.notice(React.createElement(ToastFC, Object.assign({}, props, { key: "toast" })));
67
+ }, 1);
66
68
  };
67
69
  export default {
68
70
  info(props = {}) {
@@ -35,14 +35,20 @@ class Notification extends React.Component {
35
35
  // 创造一个不重复的key
36
36
  const { notices } = this.state;
37
37
  const key = notice.key;
38
- const temp = notices.filter(item => item.key === key).length;
39
- if (!temp) {
38
+ const index = notices.findIndex(item => item.key === key);
39
+ if (index === -1) {
40
40
  // 不存在重复的 添加
41
41
  notices.push(notice);
42
42
  this.setState({
43
43
  notices,
44
44
  });
45
45
  }
46
+ else {
47
+ const temp = notices.splice(index, 1);
48
+ this.setState(Object.assign({}, {
49
+ notices: notices.concat(temp),
50
+ }));
51
+ }
46
52
  }
47
53
  // 删除一个监听项
48
54
  remove(key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "author": "cxc",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -42,5 +42,5 @@
42
42
  "dependencies": {
43
43
  "react-quill": "^2.0.0"
44
44
  },
45
- "gitHead": "ceb7610b08ba21a9f8617ef1ec29bc8ce68de1ea"
45
+ "gitHead": "c5684f151e43849aae0d861de63d04f52a0d1d70"
46
46
  }