@vigilkids/section-renderer-vue
Vue 3 adapter for OneX Section Renderer SDK
5,543
| Install | |
|---|---|
npm install @vigilkids/section-renderer-vue |
|
| Latest Version: | 0.7.19 |
| Vue: | 3 |
| Last Updated: | Oct 21, 2026 |
| Links: | npm |
Maintainer: weizhixingchen
@vigilkids/section-renderer-vue
Vue 3 rendering engine for OneX Section system. Renders section-based content with product-aware component resolution, lazy loading, inline editing, and editor preview support.
Install
pnpm add @vigilkids/section-renderer-vue
Peer Dependencies:
vue≥ 3.4
Usage
Frontend (Nuxt/Vue app)
<script setup>
import { SectionRenderer, registerArticleSections, SectionRendererPlugin } from '@vigilkids/section-renderer-vue'
// Register built-in article sections (call once at app startup)
registerArticleSections()
</script>
<template>
<SectionRenderer
:sections-data="article.content_json"
:product-code="'visiva'"
/>
</template>
Admin Preview (iframe)
import { createPreviewApp } from '@vigilkids/section-renderer-vue/editor'
createPreviewApp('#app', {
bridge: { send, on },
onSectionClick: (id) => { /* select section */ },
})
Product Styles
// Import product-specific article CSS
import '@vigilkids/section-renderer-vue/styles/vigilkids'
import '@vigilkids/section-renderer-vue/styles/visiva'
Raw HTML Utility Classes
适用于 article-custom-html 或原始 HTML 模板,作用域限定在 .article-content:
- 间距:
mt-{n}mb-{n}ml-{n}mr-{n}p-{n}px-{n}py-{n} - 自动居中:
ml-automr-automx-auto - 布局:
blockinline-block - 宽度:
w-fullw-fit - 字号:
text-12~text-36 - 字重:
font-normalfont-mediumfont-semiboldfont-boldfont-black - 对齐:
text-lefttext-centertext-right - 行高:
leading-tightleading-normalleading-relaxedleading-loose - 表格容器:
table-fixed(用在<table>,启用固定列宽布局 + 自动换行) - 列宽(像素):
col-60col-80col-100col-120col-150col-180col-200col-250col-300col-350col-400col-500 - 列宽(百分比):
col-10pcol-15pcol-20pcol-25pcol-30pcol-33pcol-40pcol-50pcol-60pcol-66pcol-70pcol-75pcol-80p
示例:
<img class="block w-fit mx-auto mb-20" src="https://raw.githubusercontent.com/vigikids/onex/HEAD/..." alt="..." />
<p class="mb-20 text-18 font-bold">%base_year%</p>
<!-- 表格列宽:必须先在 <table> 加 .table-fixed,.col-* 才会生效 -->
<table class="table-fixed">
<colgroup>
<col class="col-120" />
<col class="col-300" />
<col class="col-25p" />
</colgroup>
<thead>
<tr><th>方法</th><th>说明</th><th>限制</th></tr>
</thead>
</table>
Components
| Component | Purpose |
|---|---|
SectionRenderer |
Root renderer — iterates sections, resolves components |
SectionWrapper |
Per-section container with editor-mode highlights |
LazySection |
IntersectionObserver lazy loading with CLS prevention |
SectionErrorBoundary |
Graceful error fallback per section |
FallbackSection |
Placeholder for unregistered section types |
Composables
| Composable | Purpose |
|---|---|
useInlineEdit |
contentEditable inline text editing (double-click to edit) |
useRegistry |
Product-aware section component registration and resolution |
useSectionStyle |
Semantic tokens → Tailwind classes + inline styles |
useSectionSEO |
JSON-LD structured data generation |
useLazyRender |
IntersectionObserver visibility detection |
Section Components
28 article sections across 2 products (VigilKids + Visiva) + 2 shared:
article-heading, article-subheading, article-image, article-bullet-list, article-step-list, article-notice, article-quote, article-question, article-pros-cons, article-feature, article-cta, article-faq, article-table, article-toc, article-custom-html
Compatibility
- Vue ≥ 3.4
- Node.js ≥ 18
- ESM only
License
Related Packages
@vigilkids/cms-nuxt
Nuxt 3 module for OnEx CMS — composables, server routes, middleware, sitemap
3,364
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.7.19 | ^3.4.0 | ||
| 0.7.18 | ^3.4.0 | ||
| 0.7.17 | ^3.4.0 | ||
| 0.7.16 | ^3.4.0 | ||
| 0.7.15 | ^3.4.0 | ||
| 0.7.14 | ^3.4.0 | ||
| 0.7.13 | ^3.4.0 | ||
| 0.7.12 | ^3.4.0 | ||
| 0.7.11 | ^3.4.0 | ||
| 0.7.10 | ^3.4.0 | ||
| 0.7.9 | ^3.4.0 | ||
| 0.7.8 | ^3.4.0 | ||
| 0.7.7 | ^3.4.0 | ||
| 0.7.6 | ^3.4.0 | ||
| 0.7.5 | ^3.4.0 | ||
| 0.7.4 | ^3.4.0 | ||
| 0.7.3 | ^3.4.0 | ||
| 0.7.2 | ^3.4.0 | ||
| 0.7.1 | ^3.4.0 | ||
| 0.7.0 | ^3.4.0 | ||
| 0.6.5 | ^3.4.0 | ||
| 0.6.4 | ^3.4.0 | ||
| 0.6.3 | ^3.4.0 | ||
| 0.6.2 | ^3.4.0 | ||
| 0.6.1 | ^3.4.0 | ||
| 0.6.0 | ^3.4.0 | ||
| 0.5.4 | ^3.4.0 | ||
| 0.5.3 | ^3.4.0 | ||
| 0.5.2 | ^3.4.0 | ||
| 0.5.1 | ^3.4.0 |
Showing the latest 30 of 37. See every release on npm