-
Notifications
You must be signed in to change notification settings - Fork 0
Lesson5 #5
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
base: master
Are you sure you want to change the base?
Lesson5 #5
Conversation
| getRequest(jsonFile) { | ||
|
|
||
| return new Promise((resolve, reject) => { | ||
|
|
||
| var xhr = new XMLHttpRequest(); | ||
| xhr.open('GET', `${API}${jsonFile}`, true); | ||
|
|
||
| xhr.onreadystatechange = () => { | ||
| if (xhr.readyState === 4) { | ||
| if (xhr.status === 200) { | ||
| let response = JSON.parse(xhr.responseText); | ||
| resolve(response); | ||
| } else { | ||
| reject('Error'); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| xhr.send(); | ||
|
|
||
| }); | ||
|
|
||
| }, |
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.
у нас же был прекрасный метод с fetch, зачем усложнять?
| this.basket.push(0); | ||
| this.basket.pop(); |
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.
костыль-костыльный =( Если и идти такой дорогой то тут больше Vue.set поможет но в целом реализация у нас итак уже есть + повторил про нее на уроке.
| console.log(data); | ||
| for (let item of data) { | ||
| console.log(typeof(item)); | ||
| item['class'] = 'visible'; |
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.
это можно вынести в шаблон, ибо хранить данные о стилях в списке товаров, которые вообще не должны содержать данные о представлении.
No description provided.