diff --git a/src/layout/melissa/MelissaDocumentosTemplates.vue b/src/layout/melissa/MelissaDocumentosTemplates.vue index bb22fd5..17a1af5 100644 --- a/src/layout/melissa/MelissaDocumentosTemplates.vue +++ b/src/layout/melissa/MelissaDocumentosTemplates.vue @@ -173,6 +173,15 @@ function tipoLabel(tipo) { return TIPOS_TEMPLATE.find((t) => t.value === tipo)?.label || tipo; } +// Formata as variáveis do template como string "{{nome}}, {{outra}}…" +// (helper externo — evita conflito de {{ }} aninhado no template Vue) +function formatVarsPreview(vars, max = 5) { + if (!Array.isArray(vars) || !vars.length) return ''; + const open = '{'; + const close = '}'; + return vars.slice(0, max).map((v) => `${open}${open}${v}${close}${close}`).join(', '); +} + // ── Card menu (templates do tenant) ───────────────────── function getCardMenuItems(tpl) { const items = [ @@ -383,7 +392,7 @@ onMounted(() => { Este template usa {{ previewTemplate.variaveis.length }} variável(eis): - {{ previewTemplate.variaveis.slice(0, 5).map(v => `{{${v}}}`).join(', ') }} + {{ formatVarsPreview(previewTemplate.variaveis, 5) }} e +{{ previewTemplate.variaveis.length - 5 }}