A minimal reactive counter app — small enough to drop into a Tauri, Electron, Capacitor, or any other native-shell webview without changes.
npx serve .Open http://localhost:3000/examples/02-counter/
- Smallest possible Courvux app — no router, no store, no components, just
data+methods+computed. - Inline template in HTML (using
cv-cloakto avoid the flash of un-rendered braces). - Same API for desktop / mobile shells — Courvux makes no assumptions about being inside a browser tab.
The whole example fits in a single static folder. From the Tauri side:
# Inside your Tauri project
cd src-tauri
# In tauri.conf.json:
# "build": { "frontendDist": "../examples/02-counter" }window.__TAURI__ is available globally to the Courvux app, so you can call Rust commands from methods:
methods: {
async greet() {
const { invoke } = window.__TAURI__.core;
const msg = await invoke('greet', { name: 'world' });
// store/use the response
}
}Point BrowserWindow.loadFile() at index.html — the import map resolves relative to the HTML file, so no bundler config required.
Configure webDir in capacitor.config.ts to point at this example's directory (or a build-step copy of it).
| File | Purpose |
|---|---|
index.html |
Shell with inline styles + template |
main.js |
Counter logic (data, computed, methods) |