Commit 9c24a3cbbe8dfe5d717c843953cc544197587d79
1 parent
1788c804
上传添加导入添加loading
Showing
2 changed files
with
8 additions
and
9 deletions
src/utils/revoke.js
| ... | ... | @@ -19,6 +19,9 @@ export class Revoke { |
| 19 | 19 | // 上次插入数据时间 |
| 20 | 20 | time = 0; |
| 21 | 21 | |
| 22 | + // 最多存储10条记录(撤销步骤,最多10次,实际五次,因为点击那次不算) | |
| 23 | + recordListLen = 10; | |
| 24 | + | |
| 22 | 25 | /** |
| 23 | 26 | * @description: 插入历史记录 |
| 24 | 27 | * @param {object}record |
| ... | ... | @@ -31,9 +34,8 @@ export class Revoke { |
| 31 | 34 | this.currentRecord = JSON.stringify(record); |
| 32 | 35 | return false; |
| 33 | 36 | } |
| 34 | - | |
| 35 | 37 | this.time = nowTime; |
| 36 | - | |
| 38 | + // console.log("currentRecord","11111111"); | |
| 37 | 39 | // 判断之前是否已经存在currentRecord记录,有则存储到recordList |
| 38 | 40 | if (this.currentRecord) { |
| 39 | 41 | this.recordList.push(this.currentRecord); |
| ... | ... | @@ -44,13 +46,12 @@ export class Revoke { |
| 44 | 46 | |
| 45 | 47 | // 将json转成字符串存储 |
| 46 | 48 | this.currentRecord = JSON.stringify(record); |
| 47 | - | |
| 48 | - // 最多存储2000条记录,超过2000条记录则删除之前的记录 | |
| 49 | - if (this.length > 2000) { | |
| 49 | + //console.log("currentRecord","11111111"); | |
| 50 | + // 最多存储10条记录,超过10条记录则删除之前的记录 | |
| 51 | + if (this.recordList.length > this.recordListLen) { | |
| 50 | 52 | //unshift() 方法将新项添加到数组的开头,并返回新的长度。 |
| 51 | - this.recordList.unshift(); | |
| 53 | + this.recordList.splice(0, 1); | |
| 52 | 54 | } |
| 53 | - | |
| 54 | 55 | return true; |
| 55 | 56 | } |
| 56 | 57 | ... | ... |
src/views/bigscreenDesigner/designer/index.vue
| ... | ... | @@ -954,8 +954,6 @@ export default { |
| 954 | 954 | this.widgetOptions = this.deepClone(this.widgets[obj.index]["options"]); |
| 955 | 955 | }, |
| 956 | 956 | widgetsClick(index) { |
| 957 | - console.log("222222",process); | |
| 958 | - console.log("222222",window.location.host,reurl); | |
| 959 | 957 | const draggableArr = this.$refs.widgets; |
| 960 | 958 | //判断是否按住了shift键盘 |
| 961 | 959 | if(this.shiftEnt){ | ... | ... |