Showing
3 changed files
with
8 additions
and
5 deletions
@@ -2,7 +2,7 @@ import Vue from 'vue'; | @@ -2,7 +2,7 @@ import Vue from 'vue'; | ||
2 | export default new Vue({ | 2 | export default new Vue({ |
3 | data() { | 3 | data() { |
4 | return { | 4 | return { |
5 | - | 5 | + tempIndex: 1 |
6 | }; | 6 | }; |
7 | }, | 7 | }, |
8 | computed: { | 8 | computed: { |
@@ -10,5 +10,9 @@ export default new Vue({ | @@ -10,5 +10,9 @@ export default new Vue({ | ||
10 | }, | 10 | }, |
11 | methods: { | 11 | methods: { |
12 | 12 | ||
13 | + genId() { | ||
14 | + return Date.now() + this.tempIndex++; | ||
15 | + } | ||
16 | + | ||
13 | } | 17 | } |
14 | }); | 18 | }); |
@@ -36,7 +36,8 @@ export default { | @@ -36,7 +36,8 @@ export default { | ||
36 | productListTitle: '', | 36 | productListTitle: '', |
37 | listparams: { sort: 0} | 37 | listparams: { sort: 0} |
38 | } | 38 | } |
39 | - } | 39 | + }, |
40 | + id: this.$bus.genId() | ||
40 | }) | 41 | }) |
41 | }, | 42 | }, |
42 | onDeleteBtn(i, index) { | 43 | onDeleteBtn(i, index) { |
@@ -15,8 +15,6 @@ import selectComp from './select-comp'; | @@ -15,8 +15,6 @@ import selectComp from './select-comp'; | ||
15 | import sortTabEditor from './sortTab-editor' | 15 | import sortTabEditor from './sortTab-editor' |
16 | import ResourceService from '@/service/resource-service'; | 16 | import ResourceService from '@/service/resource-service'; |
17 | 17 | ||
18 | -let idStart = 1; | ||
19 | - | ||
20 | export default { | 18 | export default { |
21 | props: ['data', 'resContentDataId'], | 19 | props: ['data', 'resContentDataId'], |
22 | data() { | 20 | data() { |
@@ -39,7 +37,7 @@ export default { | @@ -39,7 +37,7 @@ export default { | ||
39 | }, | 37 | }, |
40 | addId(m) { | 38 | addId(m) { |
41 | m.forEach(i => { | 39 | m.forEach(i => { |
42 | - i.id = Date.now() + idStart++; | 40 | + i.id = this.$bus.genId(); |
43 | }) | 41 | }) |
44 | 42 | ||
45 | return m; | 43 | return m; |
-
Please register or login to post a comment