Appearance
π Encrypted Dynamic Props with WBC-Routes2 β
With WBC-Routes2, you can pass encrypted or compressed content directly as a prop to your routes, making your Vue app capable of rendering dynamic views from secure, shareable links.
This allows features like:
- Embedding views in URLs
- Securely passing structured data
- Building route previews without server logic
- Creating CMS live preview or collaboration tools
π§ How It Works β
At runtime, WBC-Routes2 accepts a :item route param. This param is expected to be a compressed JSON string, representing any valid WBC structure.
It will automatically:
- Decompress
- Parse
- Render with
WBCcomponent
π¦ Install lz-string (recommended) β
To compress and decompress your props:
bash
npm install lz-stringThen in your router setup:
js
import { decompressFromEncodedURIComponent } from "lz-string";
const routes = [
{
path: "/wbc/encrypted/:item",
name: "WBCEncrypted",
component: WBC,
props: route => ({
item: JSON.parse(
decompressFromEncodedURIComponent(route.params.item)
)
}),
},
];π§ͺ Example Payload β
Hereβs a sample WBC payload:
js
const myData = [
"<~div|pa-5>",
{
comp: "VCard",
options: {
class: "red lighten-2 white--text pa-3",
html: "This view was sent via encrypted props!"
}
},
{
comp: "meta",
title: "Encrypted Props Example",
description: "Rendered using WBC-Routes2 and compressed parameters.",
language: "en"
},
"./docs/wbcRoutes2Doc/introductionWbr2/introductionWbr2.md"
];Then compress:
js
import { compressToEncodedURIComponent } from "lz-string";
const encoded = compressToEncodedURIComponent(JSON.stringify(myData));
const link = `/wbc/encrypted/`{encoded}`;
console.log("π Link to share:", link);This link is a self-contained, live-rendering page.
π Full Circle: From JSON to View β
- WBC parses the object
- WBC renders components
- Meta data is injected
- Markdown file is fetched
- The view is live and reactive
No extra routing logic or view definitions are required.
βοΈ Encoded View URL Example β
Sample compressed route URL (shortened for demo):
text
/wbc/encrypted/NoIgPA...X1sAIThis may represent:
- Vuetify cards
- Markdown documentation
- Styled alerts
- Meta tags
All parsed client-side.
π Dynamic Navigation with WBC β
You can link to encrypted views programmatically:
js
this.`router.push({
name: "WBCEncrypted",
params: {
item: compressToEncodedURIComponent(JSON.stringify(myData)),
}
});π¨ Tips for Security β
- This method is great for previewing views, not protecting secrets
- Use encryption + compression if security is required
- Use signed JWT or AES if needed
- WBC expects plain JSON-compatible structure after decompression
β Use Cases β
- CMS preview with live UI components
- Temporary preview environments for PRs
- Dynamic tutorial links (Markdown + live Vue)
- Form data previews without saving to DB
- Shareable interactive dashboards
π§© Combined with Meta & Localization β
You can pass multi-language or metadata inside the encrypted object:
js
{
comp: "meta",
title: {
en: "Dynamic View",
fr: "Vue Dynamique",
ar: "ΨΉΨ±ΨΆ Ψ―ΩΩΨ§Ω
ΩΩΩ"
},
language: "auto"
}π Summary β
β
WBC-Routes2 supports encrypted dynamic routing
β
Use lz-string for compression
β
Safe, fast, no server needed
β
Supports markdown, components, metadata, and more
β
Enables truly shareable Vue-powered links