bri-components 1.2.16 → 1.2.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.2.16",
3
+ "version": "1.2.17",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -226,10 +226,10 @@
226
226
  callback: data => {
227
227
  this.initListData = [
228
228
  ...this.initListData,
229
- ...data.list.map(item =>
229
+ ...data.list.map(dataItem =>
230
230
  ({
231
- _key: item[item._key || "_key"],
232
- name: item[item._name || "name"]
231
+ _key: dataItem[item._key || "_key"],
232
+ name: dataItem[item._name || "name"]
233
233
  })
234
234
  )
235
235
  ];
@@ -37,8 +37,11 @@
37
37
  <bri-loading
38
38
  class="bri-table-empty"
39
39
  :value="isLoading ? 1 : data.length? 0 : 2"
40
- :noText="noDataText"
41
- />
40
+ >
41
+ <template slot="nodata">
42
+ {{ noDataText }}
43
+ </template>
44
+ </bri-loading>
42
45
  </div>
43
46
  </template>
44
47
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  <div
14
14
  v-else
15
- class="dsh-flex-row-center-center BriIframe-nodata"
15
+ class="BriIframe-nodata"
16
16
  >
17
17
  <img
18
18
  :src="noData"
@@ -59,25 +59,20 @@
59
59
  methods: {
60
60
  init () {
61
61
  let iframe = this.$refs.BriIframe;
62
- if (!iframe) {
63
- return;
62
+ if (iframe) {
63
+ this.loading = true;
64
+ if (iframe.attachEvent) {
65
+ iframe.attachEvent("onreadystatechange", () => {
66
+ if (iframe.readyState === "complete" || iframe.readyState == "loaded") {
67
+ this.loading = false;
68
+ }
69
+ });
70
+ } else {
71
+ iframe.addEventListener("load", () => {
72
+ this.loading = false;
73
+ }, false);
74
+ }
64
75
  }
65
- this.loading = true;
66
- if (iframe.attachEvent) {
67
- iframe.attachEvent("onreadystatechange", () => {
68
- if (iframe.readyState === "complete" || iframe.readyState == "loaded") {
69
- this.loadingEnd();
70
- }
71
- });
72
- } else {
73
- iframe.addEventListener("load", () => {
74
- this.loadingEnd();
75
- }, false);
76
- }
77
-
78
- },
79
- loadingEnd () {
80
- this.loading = false;
81
76
  },
82
77
  /**
83
78
  * 在iframe页面使用举例:
@@ -8,22 +8,24 @@
8
8
  }"
9
9
  >
10
10
  <div class="BriLoading-main">
11
- <slot>
12
- <template v-if="value === 1">
11
+ <!-- loading -->
12
+ <template v-if="value === 1">
13
+ <slot>
13
14
  <div
14
15
  class="BriLoading-main-loading"
15
16
  :style="getStyle"
16
- >
17
- </div>
17
+ ></div>
18
18
  <div
19
19
  v-if="showLoadingText"
20
20
  class="BriLoading-main-loadingText"
21
21
  >
22
22
  {{ loadText }}
23
23
  </div>
24
- </template>
25
-
26
- <template v-else-if="value === 2">
24
+ </slot>
25
+ </template>
26
+ <!-- nodata -->
27
+ <template v-else-if="value === 2">
28
+ <slot name="nodata">
27
29
  <bri-svg :src="imgSrc" />
28
30
  <div
29
31
  v-if="noText"
@@ -31,8 +33,8 @@
31
33
  >
32
34
  {{ noText }}
33
35
  </div>
34
- </template>
35
- </slot>
36
+ </slot>
37
+ </template>
36
38
  </div>
37
39
  </div>
38
40
  </template>
@@ -12,5 +12,6 @@
12
12
  &-nodata {
13
13
  width: 100%;
14
14
  height: 100%;
15
+ .dsh-flex-row-center-center();
15
16
  }
16
17
  }