0.1.0 • Published 2 years ago
primate-vue v0.1.0
Vue for Primate
A Primate Vue handler that can serve as an alternative to the native HTML handler.
Installing
npm install primate-vue
Using
Create an SFC component in components
, e.g. PostIndex.vue
.
<template>
<h1>All posts</h1>
<div v-for="post in posts">
<h2><a :href="`/vue/post/view/${post._id}`">{{post.title}}</a></h2>
</div>
</template>
Create a route using the handler.
import {router, redirect, defined} from "primate";
import vue from "primate-vue";
import Post from "../domains/Post.js";
router.get("/vue/posts", () => vue`<PostIndex posts="${Post.find()}" />`);
Resources
Primate app includes examples for routes and components that are 1:1 aligned with the HTML examples.
Alternatives
See primate-react for the same functionality in React.
License
BSD-3-Clause
0.1.0
2 years ago