mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-28 12:26:52 -06:00
M6: default Vue instance swaps and keep text out of attribute detection
A Vue component's instance-swap prop now defaults to its component reference in withDefaults, so the dynamic component renders the design default. Attribute detection only applies inside an unfinished opening tag, so text like `Total = {title}` stays text instead of becoming a quoted attribute value.
This commit is contained in:
@@ -823,10 +823,7 @@ fn vue(doc: &Document, c: &Component) -> String {
|
||||
}
|
||||
out.push_str(" }>(),\n {\n");
|
||||
for p in &props {
|
||||
// A component-valued prop has no literal to default to.
|
||||
if matches!(p.kind, ParamKind::InstanceSwap | ParamKind::Slot) {
|
||||
continue;
|
||||
}
|
||||
// An instance swap defaults to its component reference; a slot isn't in `props`.
|
||||
out.push_str(&format!(" {}: {},\n", p.ident, value_expr(doc, c, p, &p.default, CodeLang::Vue)));
|
||||
}
|
||||
out.push_str(" },\n);\n\n</script>\n\n");
|
||||
|
||||
Reference in New Issue
Block a user