信息流卡片样式编辑器

Nuxt 4 · Vue 3 · Tailwind 3.4.19 · Web 环境 · 数据源:本地存储

卡片套

核心组件 / API 接入说明 当前:信息卡

import { renderCardHtml, buildCardJson } from '~/utils/card-engine'

// 当前「信息卡」的真实样式配置(随编辑实时更新)
const style = /* 当前卡片配置 */

// 当前内容数据(renderCardHtml 的 data 参数)
const data = {}

// 传入原始数据,返回卡片 HTML 代码
const html = renderCardHtml({
  type: 'info',
  style,
  data,
  // template 可省略,默认使用内置模板
})

// 返回 JSON 配置(含样式/数据/模板/渲染结果)
const json = buildCardJson({ type: 'info', style, data })

// 在 Vue 页面中作为展现组件使用:
// <CardRenderer :type="'info'" :style="style" :data="data" />