-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Задачи по 4му занятию #4
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6c219bb
4е занятие - 1я задача
acddaea
Merge branch 'master' of https://github.com/js-tasks-ru/vue-20241213_…
cb98718
4е занятие - 2я задача
770e937
Merge branch 'master' of https://github.com/js-tasks-ru/vue-20241213_…
2ef4a68
4е занятие - 3я задача
6ca61dd
Merge branch 'master' of https://github.com/js-tasks-ru/vue-20241213_…
a164aa6
4е занятие - 4я задача
5f587b8
Merge branch 'master' of https://github.com/js-tasks-ru/vue-20241213_…
b4e47a4
4е занятие - 5я задача
2a11b27
4е занятие - 5я задача - поправил имена
22f8d7e
4е занятие - правки по ревью
2f7ee6c
4е занятие - правки по ревью 2
0c3e31e
4е занятие - правки по ревью 3
8962cab
Merge branch 'master' of https://github.com/js-tasks-ru/vue-20241213_…
5ce3e4c
5е занятие - задача 1 SFC
31a4ae5
Merge branch 'master' of https://github.com/js-tasks-ru/vue-20241213_…
45ed243
5е занятие - задача 2 MeetupCover с v-bind в CSS
5899a8b
Merge branch 'master' of https://github.com/js-tasks-ru/vue-20241213_…
beee19a
4е занятие SFC - задача 3UiStretch
9808c51
Merge branch 'master' of https://github.com/js-tasks-ru/vue-20241213_…
f147d14
4е занятие SFC - правки
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,57 @@ | ||
import { defineComponent } from 'vue' | ||
import { UiAlert, UiContainer } from '@shgk/vue-course-ui' | ||
import {defineComponent} from 'vue' | ||
import {UiAlert, UiContainer} from '@shgk/vue-course-ui' | ||
import MeetupAgenda from './MeetupAgenda.js' | ||
import MeetupDescription from './MeetupDescription.js' | ||
import MeetupCover from './MeetupCover.js' | ||
import MeetupInfo from './MeetupInfo.js' | ||
import './MeetupView.css' | ||
|
||
export default defineComponent({ | ||
name: 'MeetupView', | ||
|
||
components: { | ||
UiAlert, | ||
UiContainer, | ||
}, | ||
|
||
template: ` | ||
<div> | ||
|
||
<!-- Обложка митапа --> | ||
|
||
<UiContainer> | ||
<div class="meetup"> | ||
<div class="meetup__content"> | ||
<h2>Описание</h2> | ||
|
||
<!-- Описание митапа --> | ||
|
||
<h2>Программа</h2> | ||
|
||
<!-- Программа митапа --> | ||
<!-- Или при пустой программе - сообщение "Программа пока пуста..." в UiAlert --> | ||
<UiAlert></UiAlert> | ||
|
||
</div> | ||
<div class="meetup__aside"> | ||
|
||
<!-- Краткая информация о митапе --> | ||
|
||
<div class="meetup__aside-buttons"></div> | ||
</div> | ||
name: 'MeetupView', | ||
|
||
components: { | ||
UiAlert, | ||
UiContainer, | ||
MeetupCover, | ||
MeetupDescription, | ||
MeetupInfo, | ||
MeetupAgenda | ||
}, | ||
|
||
props: { | ||
meetup: { | ||
type: Object, | ||
require: true | ||
}, | ||
}, | ||
|
||
template: ` | ||
<div> | ||
<MeetupCover :title="meetup.title" :image="meetup.image" /> | ||
|
||
<UiContainer> | ||
<div class="meetup"> | ||
<div class="meetup__content"> | ||
<h2>Описание</h2> | ||
|
||
<MeetupDescription :description="meetup.description" /> | ||
|
||
<h2>Программа</h2> | ||
|
||
<!-- Программа митапа --> | ||
<!-- Или при пустой программе - сообщение "Программа пока пуста..." в UiAlert --> | ||
<MeetupAgenda v-if="meetup?.agenda?.length" :agenda="meetup.agenda" /> | ||
<UiAlert v-else>Программа пока пуста...</UiAlert> | ||
|
||
</div> | ||
<div class="meetup__aside"> | ||
|
||
<MeetupInfo :date="meetup.date" :organizer="meetup.organizer" :place="meetup.place" /> | ||
|
||
<div class="meetup__aside-buttons"></div> | ||
</div> | ||
</div> | ||
</UiContainer> | ||
</div> | ||
</UiContainer> | ||
</div> | ||
`, | ||
`, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
import { defineComponent } from 'vue' | ||
import {defineComponent, onMounted, onUnmounted, ref} from 'vue' | ||
|
||
const INTERVAL = 1000; | ||
export default defineComponent({ | ||
name: 'UiClock', | ||
name: 'UiClock', | ||
|
||
setup() {}, | ||
setup() { | ||
const currentTime = ref(null); | ||
let timer = 0; | ||
|
||
template: `<div class="clock">10:12:02</div>`, | ||
function setCurrentTime() { | ||
currentTime.value = new Date().toLocaleTimeString(navigator.language, {timeStyle: 'medium'}); | ||
} | ||
|
||
onMounted(() => { | ||
timer = setInterval(() => setCurrentTime(), INTERVAL) | ||
setCurrentTime() | ||
}) | ||
|
||
onUnmounted (() => { | ||
clearInterval(timer) | ||
}) | ||
|
||
return { | ||
currentTime | ||
} | ||
}, | ||
|
||
template: ` | ||
<div class="clock">{{ currentTime }}</div>`, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
import { defineComponent } from 'vue' | ||
import {defineComponent} from 'vue' | ||
|
||
export default defineComponent({ | ||
name: 'EmailListItem', | ||
name: 'EmailListItem', | ||
|
||
props: { | ||
email: { | ||
type: String, | ||
required: true, | ||
}, | ||
props: { | ||
email: { | ||
type: String, | ||
required: true, | ||
}, | ||
|
||
marked: { | ||
type: Boolean, | ||
default: false, | ||
marked: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}, | ||
}, | ||
|
||
template: ` | ||
<li :class="{ marked }"> | ||
{{ email }} | ||
<button type="button" aria-label="Удалить" @click.stop>❌</button> | ||
</li> | ||
`, | ||
emits: ['click-del'], | ||
|
||
template: ` | ||
<li :class="{ marked }"> | ||
{{ email }} | ||
<button type="button" aria-label="Удалить" @click.stop="$emit('click-del')">❌</button> | ||
</li> | ||
`, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,75 @@ | ||
import { computed, defineComponent, ref } from 'vue' | ||
import { UiFormGroup, UiInput } from '@shgk/vue-course-ui' | ||
import {computed, defineComponent, ref} from 'vue' | ||
import {UiFormGroup, UiInput} from '@shgk/vue-course-ui' | ||
import EmailList from './EmailList.js' | ||
|
||
// Значения взяты из https://jsonplaceholder.typicode.com/comments | ||
export function getEmails() { | ||
return [ | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
] | ||
return [ | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
] | ||
} | ||
|
||
export default defineComponent({ | ||
name: 'MarkedEmailsApp', | ||
name: 'MarkedEmailsApp', | ||
|
||
components: { | ||
UiFormGroup, | ||
UiInput, | ||
EmailList, | ||
}, | ||
components: { | ||
UiFormGroup, | ||
UiInput, | ||
EmailList, | ||
}, | ||
|
||
setup() { | ||
const emails = ref(getEmails()) | ||
const query = ref('') | ||
setup() { | ||
const emails = ref(getEmails()) | ||
const query = ref('') | ||
|
||
const markedEmails = computed(() => { | ||
return emails.value.map(email => ({ | ||
email, | ||
isMarked: !!(query.value && email.toLowerCase().includes(query.value.toLowerCase())), | ||
})) | ||
}) | ||
const markedEmails = computed(() => { | ||
return emails.value.map(email => ({ | ||
email, | ||
isMarked: !!(query.value && email.toLowerCase().includes(query.value.toLowerCase())), | ||
})) | ||
}) | ||
|
||
function removeEmailByIndex(index) { | ||
emails.value.splice(index, 1) | ||
} | ||
function removeEmailByIndex(index) { | ||
emails.value.splice(index, 1) | ||
} | ||
|
||
return { | ||
query, | ||
markedEmails, | ||
removeEmailByIndex, | ||
} | ||
}, | ||
return { | ||
query, | ||
markedEmails, | ||
removeEmailByIndex, | ||
} | ||
}, | ||
|
||
template: ` | ||
<div> | ||
<UiFormGroup> | ||
<UiInput v-model.trim="query" type="search" placeholder="Поиск" aria-label="Поиск" small /> | ||
</UiFormGroup> | ||
<EmailList :emails="markedEmails" /> | ||
</div> | ||
`, | ||
template: ` | ||
<div> | ||
<UiFormGroup> | ||
<UiInput v-model.trim="query" type="search" placeholder="Поиск" aria-label="Поиск" small/> | ||
</UiFormGroup> | ||
<EmailList :emails="markedEmails" @remove="removeEmailByIndex"/> | ||
</div> | ||
`, | ||
}) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meetup
описан, как обязательный параметр, поэтому его не нужно проверять наnull
через?.