diff --git a/02-basics-2/20-broken-map/MapApp.js b/02-basics-2/20-broken-map/MapApp.js
index 0f02384..7045a1b 100644
--- a/02-basics-2/20-broken-map/MapApp.js
+++ b/02-basics-2/20-broken-map/MapApp.js
@@ -5,8 +5,8 @@ export default defineComponent({
setup() {
// Реактивные переменные для хранения координат метки
- let x = ref(0);
- let y = ref(0);
+ const x = ref(0);
+ const y = ref(0);
/**
* Обработчик клика по карте для установки координат метки
diff --git a/02-basics-2/30-calculator/CalculatorApp.js b/02-basics-2/30-calculator/CalculatorApp.js
index 381b03f..883097e 100644
--- a/02-basics-2/30-calculator/CalculatorApp.js
+++ b/02-basics-2/30-calculator/CalculatorApp.js
@@ -1,26 +1,55 @@
-import { defineComponent } from 'vue'
+import { defineComponent, ref, computed, } from 'vue'
export default defineComponent({
name: 'CalculatorApp',
- setup() {},
+ setup() {
+
+ const operand1 = ref(0);
+
+ const operand2 = ref(0);
+
+ const operator = ref('sum');
+
+ const result = computed(() => {
+ switch (operator.value) {
+ case 'sum':
+ return operand1.value + operand2.value
+ case 'subtract':
+ return operand1.value - operand2.value
+ case 'multiply':
+ return operand1.value * operand2.value
+ case 'divide':
+ return operand1.value / operand2.value
+ default:
+ return operand1.value + operand2.value;
+ }
+ })
+
+ return {
+ operand1,
+ operand2,
+ operator,
+ result,
+ }
+ },
template: `
`,
})
diff --git a/02-basics-2/40-marked-emails/MarkedEmailsApp.js b/02-basics-2/40-marked-emails/MarkedEmailsApp.js
index 8de9625..ed72861 100644
--- a/02-basics-2/40-marked-emails/MarkedEmailsApp.js
+++ b/02-basics-2/40-marked-emails/MarkedEmailsApp.js
@@ -32,19 +32,35 @@ export const emails = [
export default defineComponent({
name: 'MarkedEmailsApp',
- setup() {},
+ setup() {
+
+ const emailsArrow = ref(emails);
+
+ const inputEmail = ref('');
+
+ const filteredEmails = computed(() => {
+ return emailsArrow.value.map(email => ({
+ email,
+ marked: email.toLowerCase().includes( inputEmail.value.toLowerCase() ) && inputEmail.value !== '',
+ }))
+ })
+
+ return {
+ emailsArrow,
+ inputEmail,
+ filteredEmails,
+ }
+ },
template: `
diff --git a/02-basics-2/50-selected-meetup/SelectedMeetupApp.js b/02-basics-2/50-selected-meetup/SelectedMeetupApp.js
index dad23b8..66f3daa 100644
--- a/02-basics-2/50-selected-meetup/SelectedMeetupApp.js
+++ b/02-basics-2/50-selected-meetup/SelectedMeetupApp.js
@@ -1,78 +1,104 @@
-import { defineComponent } from 'vue'
-// import { getMeetup } from './meetupsService.ts'
+import { defineComponent, ref, watch } from 'vue'
+import { getMeetup } from './meetupsService.ts'
export default defineComponent({
name: 'SelectedMeetupApp',
- setup() {},
+ setup() {
+ const currentId = ref(1)
+ const meetupTitle = ref('')
+
+ const pages = [
+ {
+ id: 'meetup-id-1',
+ name: 'meetupId',
+ value: 1,
+ },
+ {
+ id: 'meetup-id-2',
+ name: 'meetupId',
+ value: 2,
+ },
+ {
+ id: 'meetup-id-3',
+ name: 'meetupId',
+ value: 3,
+ },
+ {
+ id: 'meetup-id-4',
+ name: 'meetupId',
+ value: 4,
+ },
+ {
+ id: 'meetup-id-5',
+ name: 'meetupId',
+ value: 5,
+ },
+ ]
+
+ const prevMeetup = () => {
+ currentId.value--
+ }
+
+ const nextMeetup = () => {
+ currentId.value++
+ }
+
+ const fetchMeetups = async id => {
+ try {
+ const meetup = await getMeetup(id)
+ meetupTitle.value = meetup.title
+ } catch (e) {
+ console.error(e)
+ return ''
+ }
+ }
+
+ watch(
+ currentId,
+ newId => {
+ fetchMeetups(newId)
+ },
+ { immediate: true },
+ )
+
+ return {
+ meetupTitle,
+ currentId,
+ prevMeetup,
+ nextMeetup,
+ pages,
+ }
+ },
template: `
-
+
-
Some Meetup Title
+ {{meetupTitle}}
`,
-})
+})
\ No newline at end of file