diff --git a/src/components/VirtualKeyboard.vue b/src/components/VirtualKeyboard.vue index 0657147..9d1ea62 100644 --- a/src/components/VirtualKeyboard.vue +++ b/src/components/VirtualKeyboard.vue @@ -32,8 +32,7 @@ - + { - this.$nextTick(() => { - this.$refs.currentButtonRect.getNode().cache(); - this.$refs.currentButtonText.getNode().cache(); - }); - }); + if (this.currentButtonId !== this.cachedCurrentButtonId && this.$refs.currentButtonRect != null) { + this.$refs.currentButtonRect.getNode().cache(); + this.cachedCurrentButtonId = this.currentButtonId; } this.currentButton = button; this.currentButtonId = button.id; @@ -473,6 +469,16 @@ //判断字符是否为空的方法 isEmpty: function (obj) { return typeof obj == "undefined" || obj == null || obj === ""; + }, + saveHistory: function (newConfig) { + this.configHistory[this.configIndex + 1] = this.deepCopy(newConfig); + this.configIndex++; + }, + revoke: function () { + this.configIndex--; + }, + redo: function () { + this.configIndex++; } } }