Clear History button will look disabled when there is no history
This commit is contained in:
@@ -108,7 +108,7 @@
|
|||||||
<legend v-on:click="collapse">History ↕</legend>
|
<legend v-on:click="collapse">History ↕</legend>
|
||||||
<div class="collapsible">
|
<div class="collapsible">
|
||||||
<ul>
|
<ul>
|
||||||
<li><button v-on:click="clearHistory">Clear History</button></li>
|
<li><button v-bind:class="{ disabled: noHistoryToClear }" v-on:click="clearHistory">Clear History</button></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul v-for="entry in history">
|
<ul v-for="entry in history">
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ const app = new Vue({
|
|||||||
history: window.localStorage.getItem('history') ? JSON.parse(window.localStorage.getItem('history')) : []
|
history: window.localStorage.getItem('history') ? JSON.parse(window.localStorage.getItem('history')) : []
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
|
noHistoryToClear() {
|
||||||
|
return this.history.length === 0;
|
||||||
|
},
|
||||||
|
|
||||||
urlNotValid() {
|
urlNotValid() {
|
||||||
const pattern = new RegExp('^(https?:\\/\\/)?' +
|
const pattern = new RegExp('^(https?:\\/\\/)?' +
|
||||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' +
|
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' +
|
||||||
|
|||||||
Reference in New Issue
Block a user