Skip to content

Commit

Permalink
counter app
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmenshikov committed Aug 18, 2024
1 parent f2c69f8 commit 641b8a4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions 02-basics-2/10-counter/CounterApp.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
import { defineComponent } from 'vue'
import { defineComponent, ref } from 'vue'

export default defineComponent({
name: 'CounterApp',

setup() {},
setup() {
const count = ref(0);
const min = 0;
const max = 5;

return {
count,
min,
max,
}
},

template: `
<div class="counter">
<button
class="button button--secondary"
type="button"
aria-label="Decrement"
disabled
:disabled="count <= min"
@click="count--"
>➖</button>
<span class="count" data-testid="count">0</span>
<span class="count" data-testid="count">{{ count }}</span>
<button
class="button button--secondary"
type="button"
aria-label="Increment"
:disabled="count >= max"
@click="count++"
>➕</button>
</div>
`,
Expand Down

0 comments on commit 641b8a4

Please sign in to comment.