amis icon indicating copy to clipboard operation
amis copied to clipboard

显示跨域,不能正常加载.json文件

Open manguanghui opened this issue 5 years ago • 1 comments

实现场景:

存在的问题:

image

当前方案:

<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8" />
  <title>amis admin</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" title="default" href="sdk/sdk.css" />
  <link rel="stylesheet" href="sdk/helper.css" />
  <script src="sdk/sdk.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>
  <script>
    (function () {
      let amis = amisRequire('amis/embed');

      let amisJSON = {
        type: 'app',
        // label: '登录页面',
        brandName: 'Admin',
        logo: 'E:/license/amis-license/public/logo.png',
        header: {
          type: 'tpl',
          inline: false,
          className: 'w-full',
          tpl: '<div class="flex justify-between"><div>顶部区域左侧</div><div>顶部区域右侧</div></div>'
        },
        api: 'amis-license/pages/site.json',
      };
      let amisInstance = amis.embed(
        '#root',
        amisJSON,
        {});
    })();
  </script>
</body>

</html>

manguanghui avatar Jul 20 '21 01:07 manguanghui

确认一下这个文件是否存在吧

nwind avatar Sep 11 '21 10:09 nwind