domc icon indicating copy to clipboard operation
domc copied to clipboard

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

Open trsh opened this issue 7 years ago • 6 comments
trafficstars

Could not find any examples.

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

This is just variable change.

trsh avatar Nov 10 '18 15:11 trsh

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 }}`
  });

trsh avatar Nov 11 '18 09:11 trsh

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

Freak613 avatar Nov 11 '18 09:11 Freak613

@Freak613 should be high priority :)

trsh avatar Nov 11 '18 10:11 trsh

Any news on this?

kokujin avatar Apr 14 '19 07:04 kokujin

Not so. I'll update ticket once implemented.

Freak613 avatar Apr 16 '19 06:04 Freak613

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

rozek avatar Jan 24 '23 15:01 rozek