Skip to content

Commit

Permalink
learneo tutorial todoList: VdomUtil.findVdomChild is not a function #…
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiu committed Jan 16, 2025
1 parent d38bf4b commit ec387cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion resources/data/deck/learnneo/pages/tutorials/TodoList.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class MainComponent extends Component {
let me = this,
cls = ['far', 'fa-square'],
oldCls = ['fa', 'fa-check'],
node = VdomUtil.findVdomChild(me.vdom, data.path[0].id).vdom;
node = VdomUtil.find(me.vdom, data.path[0].id).vdom;

if (data.path[0].cls.includes('fa-square')) {
cls = ['fa', 'fa-check'];
Expand Down
12 changes: 6 additions & 6 deletions resources/data/deck/training/pages/2023-02-05T17-44-53-815Z.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Use the utility method, replacing the statement referencing the vdom hierarchy.

<pre>
<s>view.vdom.cn[0].innerHTML = business.title;</s>
Neo.util.VDom.findVdomChild(view.vdom, 'title').vdom.innerHTML = business.title;
Neo.util.VDom.find(view.vdom, 'title').vdom.innerHTML = business.title;
</pre>


Expand All @@ -86,17 +86,17 @@ calling the function.

Code a new class member.

findVdomChild = Neo.util.VDom.findVdomChild
find = Neo.util.VDom.find

Then use it in the after set method. Here's how that part of the code will look afterwards.

<pre style="color:gray; padding: 8px; border: thin solid lightgray;">
findVdomChild = Neo.util.VDom.findVdomChild;
find = Neo.util.VDom.find;

afterSetBusiness(business){
if (!business) return;
const view = this.getReference('view');
this.findVdomChild(view.vdom, 'title').vdom.innerHTML = business.title;
this.find(view.vdom, 'title').vdom.innerHTML = business.title;
view.update();
}
</pre>
Expand Down Expand Up @@ -129,7 +129,7 @@ Then back in the details view, update the vdom as follows.

Then modify the `afterSetBusiness()` method to update the element's `src`.

this.findVdomChild(view.vdom, 'thumbnail').vdom.src = business.imageUrl;
this.find(view.vdom, 'thumbnail').vdom.src = business.imageUrl;

??Add the address

Expand Down Expand Up @@ -184,7 +184,7 @@ of thought and try it. If you get stuck, that code is given in the next lab step

Here's one way to code it. How does this compare to your solution?

this.findVdomChild(view.vdom, 'address').vdom.cn = business
this.find(view.vdom, 'address').vdom.cn = business
.address
.map(item => ({tag: 'div', innerHTML: item}));

Expand Down

0 comments on commit ec387cd

Please sign in to comment.