console
let amis = amisRequire('amis/embed');
let amisJSON = {
type: 'page',
body: {
type: 'form',
title: "API下单",
mode: 'horizontal',
api: 'http://ttt.chzlan.com/api/ext/api_buy',
// persistDataKeys: ["checkoutProfileId"],
persistData:'sdfaafd',
body: [ {
label: '地址ID',
type: 'input-text',
name: 'checkoutProfileId',
required: true,
trimContents:true,
"validations": {
"matchRegexp": '/^[A-Z0-9]{32}$/'
},
"validationErrors": {
"matchRegexp": "请输入正确的地址ID格式"
},
"transform": {
"upperCase": true
},
}, {
label: '型号',
type: 'input-text',
name: 'model',
required: true,
trimContents:true,
"validations": {
"matchRegexp": '/^[A-Z0-9-./]{4,}$/'
},
"validationErrors": {
"matchRegexp": "请输入正确的型号格式"
},
"transform": {
"upperCase": true
},
}, {
label: '数量',
type: 'input-number',
name: 'quantity',
"validateOnChange": true,
"validations": {
minimum:250,
},
trimContents:true,
required: true
}
]
}
};
let amisScoped = amis.embed('#root', amisJSON);
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<title>amis demo</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://cdn.staticfile.org/amis/2.8.0/sdk.min.css" />
<link rel="stylesheet" href="https://cdn.staticfile.org/amis/2.8.0/helper.min.css" />
<link rel="stylesheet" href="https://cdn.staticfile.org/amis/2.8.0/iconfont.min.css" />
<script src="https://cdn.staticfile.org/amis/2.8.0/sdk.min.js"></script>
<script src="https://cdn.staticfile.org/amis/2.8.0/exceljs.min.js"></script>
<script src="https://cdn.staticfile.org/amis/2.0.0-rc.10/rest.min.js"></script>
<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>
</body>
</html>