Amis โ
ไธไธชไฝไปฃ็ ๅ็ซฏๆกๆถ๏ผๅฎไฝฟ็จ JSON ้ ็ฝฎๆฅ็ๆ้กต้ข๏ผๅฏไปฅๅๅฐ้กต้ขๅผๅๅทฅไฝ้๏ผๆๅคงๆๅๆ็ใ
https://aisuda.bce.baidu.com/amis/zh-CN/docs/index
install โ
bash
npm install amis
usage โ
sdk ๅฝขๅผ
npm i amis
ๆฅไธ่ฝฝ๏ผๅจnode_modules\amis\sdk
็ฎๅฝ้ๅฐฑ่ฝๆพๅฐใ
html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<title>Amis ็คบไพ</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"
/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<link rel="stylesheet" href="https://unpkg.com/amis@latest/sdk/sdk.css" />
<link
rel="stylesheet"
href="https://unpkg.com/amis@latest/sdk/helper.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/amis@latest/sdk/iconfont.css"
/>
<style>
html,
body,
.app-wrapper {
position: relative;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="root" class="app-wrapper"></div>
<script src="https://unpkg.com/amis@latest/sdk/sdk.js"></script>
<script src="amis.js"></script>
</body>
</html>
js
(function () {
let amis = amisRequire("amis/embed");
let amisScoped = amis.embed("#root", {
type: "page",
title: "Amis ็คบไพ้กต้ข",
body: [
{
type: "form",
title: "็จๆทไฟกๆฏ่กจๅ",
api: "/api/mock2/form/saveForm",
body: [
{
type: "input-text",
name: "name",
label: "ๅงๅ",
},
{
type: "input-email",
name: "email",
label: "้ฎ็ฎฑ",
},
{
type: "input-number",
name: "age",
label: "ๅนด้พ",
},
{
type: "submit",
label: "ๆไบค",
},
],
},
{
type: "crud",
title: "็จๆทๅ่กจ",
api: "/api/mock2/sample",
columns: [
{
name: "id",
label: "ID",
},
{
name: "engine",
label: "ๅผๆ",
},
{
name: "browser",
label: "ๆต่งๅจ",
},
{
name: "platform",
label: "ๅนณๅฐ",
},
{
name: "version",
label: "็ๆฌ",
},
{
name: "grade",
label: "็ญ็บง",
},
],
},
],
});
})();