Draft
Conversation
Member
|
I think this is useful and should come at no cost of learning if it follows closely the existing syntax of JS:
I remember this was proposed in the back in vuejs/vue, it might be worth checking the existing issues/discussions on it if you haven't already |
Member
Author
|
tonaly agree! |
|
It would be nice to lay out the interaction with other DOM-controlling directives, like Is it ok to put <!-- is this allowed? -->
<template v-match>
<div v-case v-if />
<div v-else>Still in first case?</div>
<div v-case />
<div v-case />
</template>
<!-- if not then this is they way I guess? -->
<template v-match>
<template v-case>
<div v-if />
<div v-else>Still in first case?</div>
</template>
<div v-case />
<div v-case />
</template>I assume all tags inside the v-match MUST have a v-case and no text node is allowed? |
Member
Author
probably like: <template v-case>Text</template> |
mizchi
added a commit
to mizchi/vapor-moon
that referenced
this pull request
Mar 26, 2026
…dapted for MoonBit) Implement patterned templates inspired by Vue RFC #823, generating native MoonBit match expressions instead of equality comparisons. Supports: - String literal matching: v-case='"loading"' - Enum pattern matching: v-case='Ok(data)' with variable binding - Wildcard/default: v-case='_' or v-case.default - Nested match expressions Validation: - v-case must be direct child of v-match element - At most one v-case.default per v-match - v-match must have at least one v-case child - Non-v-case elements inside v-match are rejected Codegen generates MoonBit match expressions for both client (DOM) and server (SSR) targets. Refs: vuejs/rfcs#823 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP