Skip to content

Commit

Permalink
Выбранный митап
Browse files Browse the repository at this point in the history
  • Loading branch information
stilvery committed Dec 24, 2024
1 parent 94007ba commit 18c72f0
Showing 1 changed file with 26 additions and 50 deletions.
76 changes: 26 additions & 50 deletions 02-basics-2/50-selected-meetup/SelectedMeetupApp.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,51 @@
import { defineComponent } from 'vue'
// import { getMeetup } from './meetupsService.ts'
import { defineComponent, ref, watchEffect } from 'vue'
import { getMeetup } from './meetupsService.ts'

export default defineComponent({
name: 'SelectedMeetupApp',

setup() {},
setup() {
const metupId = ref(1)
const meetup = ref({})
watchEffect(async () => {
await getMeetup(metupId.value).then((data) => {
meetup.value = data
})
})


return {
meetup,
metupId
}
},

template: `
<div class="meetup-selector">
<div class="meetup-selector__control">
<button class="button button--secondary" type="button" disabled>Предыдущий</button>
<button @click="metupId--" class="button button--secondary" type="button" :disabled="metupId < 2">Предыдущий</button>
<div class="radio-group" role="radiogroup">
<div class="radio-group__button">
<input
id="meetup-id-1"
class="radio-group__input"
type="radio"
name="meetupId"
value="1"
/>
<label for="meetup-id-1" class="radio-group__label">1</label>
</div>
<div class="radio-group__button">
<input
id="meetup-id-2"
class="radio-group__input"
type="radio"
name="meetupId"
value="2"
/>
<label for="meetup-id-2" class="radio-group__label">2</label>
</div>
<div class="radio-group__button">
<div v-for="id in 5" class="radio-group__button">
<input
id="meetup-id-3"
:id="\`meetup-id-\${id}\`"
class="radio-group__input"
type="radio"
name="meetupId"
value="3"
:value="id"
v-model="metupId"
/>
<label for="meetup-id-3" class="radio-group__label">3</label>
</div>
<div class="radio-group__button">
<input
id="meetup-id-4"
class="radio-group__input"
type="radio"
name="meetupId"
value="4"
/>
<label for="meetup-id-4" class="radio-group__label">4</label>
</div>
<div class="radio-group__button">
<input
id="meetup-id-5"
class="radio-group__input"
type="radio"
name="meetupId"
value="5"
/>
<label for="meetup-id-5" class="radio-group__label">5</label>
<label :for="\`meetup-id-\${id}\`" class="radio-group__label">{{id}}</label>
</div>
</div>
<button class="button button--secondary" type="button">Следующий</button>
<button @click="metupId++" :disabled="metupId > 4" class="button button--secondary" type="button">Следующий</button>
</div>
<div class="meetup-selector__cover">
<div class="meetup-cover">
<h1 class="meetup-cover__title">Some Meetup Title</h1>
<h1 class="meetup-cover__title">{{meetup.title}}</h1>
</div>
</div>
Expand Down

0 comments on commit 18c72f0

Please sign in to comment.