riot-js

Open full view…

Dynamic tags once more

clyndon
Fri, 17 Feb 2017 01:06:47 GMT

Hey @all I still don't get if and how it's possible to do something like: on('mount', function(){ var focus = document.createElement("focus") this.mid.appendChild(focus) riot.mount("focus", {currentFocus: opts.currentFocus}) } The "focus" tag get's rendered as expected but it has no parent and it does not become a part of root.tags[]. I guess that is why the focus tag never gets updated on root.update(). My goal is to have a fully dynamic layout where I can put several different tags into different grid locations - loaded from a json config file. I think it has been discussed here https://github.com/riot/riot/issues/1174. But I can't see a solution to the problem, though. If I do it this way: on('mount', function(){ var focus = document.createElement("focus") this.mid.appendChild(focus) var subTag = riot.mount("focus", {currentFocus: opts.currentFocus})[0] this.tags['focus'] = subTag } Then I get this result: this.tags[sometag:Tag$1, focus:Object]. I need focus to be a "Tag$1" too. Any help is much appreciated. Thanks