Skip to content

Commit

Permalink
Merge pull request #4 from KiraIsmailova/master
Browse files Browse the repository at this point in the history
создание счетчика
  • Loading branch information
jsru-1 authored Dec 25, 2024
2 parents 34dea65 + 88df332 commit d1420c9
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions 02-basics-2/10-counter/CounterApp.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,44 @@
import { defineComponent } from 'vue'
import { defineComponent, ref } from 'vue'

export default defineComponent({
name: 'CounterApp',

setup() {},
setup() {
const counter = ref(0);

function increase() {
counter.value++;
}

function decrease() {
counter.value--;
}

return {
counter,
increase,
decrease,
}
},

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

0 comments on commit d1420c9

Please sign in to comment.