Added a Clear History button

This commit is contained in:
Andrew Bastin
2019-08-23 10:48:27 +05:30
parent a7c29e4016
commit b8f9f23684
2 changed files with 9 additions and 0 deletions

View File

@@ -107,6 +107,9 @@
<fieldset class="history hidden">
<legend v-on:click="collapse">History ↕</legend>
<div class="collapsible">
<ul>
<li><button v-on:click="clearHistory">Clear History</button></li>
</ul>
<ul v-for="entry in history">
<li>
<label for="time">Time</label>

View File

@@ -79,6 +79,12 @@ const app = new Vue({
this.history.splice(this.history.indexOf(entry), 1)
window.localStorage.setItem('history', JSON.stringify(this.history))
},
clearHistory() {
this.history = []
window.localStorage.setItem('history', JSON.stringify(this.history))
},
useHistory({
method,
url,