Skip to content
Sean Chou edited this page Jul 3, 2024 · 3 revisions

This is a very simple introduction.

Step 1: docker-compose up -d

Step 2: open http://127.0.0.1/grafana

it is a grafana, and default login is admin:admin

Step 3: create a dashboard

Step 4: create a panel of type "Text", select mode "HTML", input the below and save:

<link rel="stylesheet" type="text/css" href="../my01/amis/sdk/sdk.css" />
<link rel="stylesheet" type="text/css" href="../my01/amis/sdk/helper.css" />
<link rel="stylesheet" type="text/css" href="../my01/amis/sdk/iconfont.css" />

<style>
  html,
  body,
  .app-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
  }
</style>

<div id="root2" class="app-wrapper"></div>
<!-- script src="https://unpkg.com/amis/lib/index.js"></script-->
<script type="module">
  import * as sdk1 from "../my01/amis/sdk/sdk.js"
  (function () {
    let amis = amisRequire('amis/embed');
    // 通过替换下面这个配置来生成不同页面
    let amisJSON = {
      type: 'page',
      title: 'form demo',
      body: {
        type: 'form',
        mode: 'horizontal',
        api: '/saveForm',
        body: [
          {
            label: 'Name',
            type: 'input-text',
            name: 'name'
          },
          {
            label: 'Email',
            type: 'input-email',
            name: 'email'
          }
        ]
      }
    };
    let amisScoped = amis.embed('#root2', amisJSON);
  })();
</script>

Step 5: refresh the dashboard and it should have a panel with a simple form.

Clone this wiki locally