Skip to content
Snippets Groups Projects
Commit 5b823e2b authored by Theo Taccoen's avatar Theo Taccoen
Browse files

on avance encore

parent f9afba37
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ export class Component { ...@@ -15,6 +15,7 @@ export class Component {
this.children.forEach(element => { this.children.forEach(element => {
str += element; str += element;
}); });
} else if (this.children instanceof Component) {
} else { } else {
str = this.children; str = this.children;
} }
...@@ -33,16 +34,26 @@ export class Component { ...@@ -33,16 +34,26 @@ export class Component {
export class Img extends Component {} export class Img extends Component {}
const title = new Component('h1', null, ['La', ' ', 'carte']); // const title = new Component('h1', null, ['La', ' ', 'carte']);
document.querySelector('.pageTitle').innerHTML = title.render(); // document.querySelector('.pageTitle').innerHTML = title.render();
const img = new Img('img', { // const img = new Img('img', {
name: 'src', // name: 'src',
value: // value:
'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300', // 'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300',
}); // });
//document.querySelector('.pageContent').innerHTML = img.render();
const c = new Component('article', { name: 'class', value: 'pizzaThumbnail' }, [
new Img(
'https://images.unsplash.com/photo-1532246420286-127bcd803104?fit=crop&w=500&h=300'
),
'Regina',
]);
document.querySelector('.pageContent').innerHTML = c.render();
document.querySelector('.pageContent').innerHTML = img.render(); // retourne : <article class="pizzaThumbnail">Regina</article>
const data = [ const data = [
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment