This repository has been archived by the owner on Mar 25, 2023. It is now read-only.
v0.2.4-alpha
Pre-release
Pre-release
This version we create user API again.
tntjs already has a future direction, which is the development of large-scale multi-page websites, and maintains native and efficient development
How to use?
If I want to make a counter app and judeg the number is odd or even.
//App.js
import { TNTApp } from "https://cdn.jsdelivr.net/npm/tntjs@latest/dist/src/index.js"
const app = new TNTApp()
app.page({
data: {
number: 1
},
computed: {
isOddOrEven() {
if (data.number % 2 === 0) return "Even"
else return "Odd";
}
},
mount: document.getElementById("app")
}, "comput")
export default app;
every page have a unique page id
<page-id>comput</page-id>
You can use the page()
to log on a page app
<!DOCTYPE html>
<!--index.html-->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tntjs comput demo</title>
<page-id>comput</page-id>
</head>
<body>
<div id="app">
<div>
<v data="number" style="font-size: 100px"></v><br/>
<button onclick="data.number += 1">+1</button>
<button onclick="data.number -= 1">-1</button><br/>
The number is: <v data="isOddOrEven"></v>
</div>
</div>
<script type="module" src="./App.js"></script>
</body>
</html>