Freak613 / domc

DOM compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Q] How do we add conditional HTML or domc components?

trsh opened this issue · comments

commented

Could not find any examples.

update: scope => {
        return {
            someCond: scope.localVar === 'me' ? 'yes' : 'no'
        }
    },

This is just variable change.

commented

Something like this?

domc.component("input-title", {
    create: scope => {
      return {};
    },
    update: scope => {
      return {
        html: scope.showControl() ? `<div class="input-title">{{ input.name }}</div>` : ``
      };
    },
    template: `{{ html }}`
  });

Not like that.
The library missing v-if directive for now and doesn't support node replacing, allowing only insert it at first render.

commented

@Freak613 should be high priority :)

Any news on this?

Not so. I'll update ticket once implemented.

I've just proposed a sketch of a possible implementation of a v-if directive as a separate issue which might be of help...