Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RRFC] Support v-if v-else-if v-else #46

Open
1 task done
mantou132 opened this issue Feb 23, 2025 · 1 comment
Open
1 task done

[RRFC] Support v-if v-else-if v-else #46

mantou132 opened this issue Feb 23, 2025 · 1 comment

Comments

@mantou132
Copy link

  • I searched for an existing RRFC which might be relevant to my RRFC

Motivation

Simplify conditional templates

Example

html`
      <div v-if=${isEmpty} class="placeholder">${this.placeholder}</div>
      <div v-else-if=${!this.multiple} class="value">${currentLabels}</div>
      <dy-scroll-box v-else class="values">
        ${typeof currentLabels?.at(0) === 'object' ? currentLabels : currentLabels?.join(', ')}
      </dy-scroll-box>
    `

How

Implemented in the _clone method of TemplateInstance

Current Behavior

Desired Behavior

References

  • n/a
@vospascal
Copy link

would it not make more sense instead of baking this in. Having this as directive you can release this as a package of even part of a collection of directives for others to use. see https://lit.dev/docs/templates/directives/ i saw in your project you where changing internals for this which would make updating the dependencies harder down the road. Using directives would probably give you a more straight update path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants