diff --git a/assets/main.js b/assets/main.js index 2ed665e..bb68d21 100644 --- a/assets/main.js +++ b/assets/main.js @@ -4,7 +4,8 @@ Vue.createApp({ del: localStorage.delActive ? localStorage.delActive : false, label: '', item: '', - items: [] + items: [], + histories: [] } }, watch: { @@ -24,14 +25,17 @@ Vue.createApp({ }, methods: { addItem () { - this.item = eval(this.item.replace(/[^-()\d/*+.]/g, '')) //parse the math expression, but sanitize it + let item = this.item.replace(/[^-()\d/*+.]/g, '') //parse the math expression, but sanitize it + this.item = eval(item) if (!isNaN(this.item) && this.item!=0) { this.items.unshift(this.item * 1) //or push - whatever works for you + this.histories.unshift(item) } this.item = '' }, removeItem (n) { this.items.splice(n, 1) + this.histories.splice(n, 1) }, undoAddition () { if (this.del) { diff --git a/assets/style.css b/assets/style.css index 1600b4d..0e29c78 100644 --- a/assets/style.css +++ b/assets/style.css @@ -54,9 +54,16 @@ ul.items li { margin-bottom: 1px; font-size: 22px; display: grid; +} + +.grid-col-2 { grid-template-columns: 1fr 1fr; } +.grid-col-3 { + grid-template-columns: 1fr 1fr 1fr; +} + ul.items li.seperator { height: 1px; background-color: #ccc; diff --git a/index.html b/index.html index 2d6f023..9dbbb8a 100644 --- a/index.html +++ b/index.html @@ -28,14 +28,15 @@