baidu / baidu/amis

如何复制得到Tab里面的模版经过渲染后HTML内容

Open
#5,503 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

style
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

实现场景:

请问以下功能如何实现,在此先谢过各位大神:)

点击“复制”按钮后 ,自动将当前选中的tab的body里的HTML内容复制到剪贴板。

例如:
1.当前tab的“收入“选中的时候,点击复制按钮后,剪贴板里面得到 “金额:199元”,
2.当前tab的“支出“选中的时候,点击复制按钮后,剪贴板里面得到 “金额:299元”。

存在的问题:

请简单描述你现在遇到的不符合预期的问题...

当前方案:

请粘贴你当前方案的完整 amis schema 代码...

<link href="https://cdn.bootcdn.net/ajax/libs/amis/2.3.0/sdk.min.css" rel="stylesheet">
<script src="https://cdn.bootcdn.net/ajax/libs/amis/2.3.0/sdk.min.js"></script>

    <div id="root" class="app-wrapper"></div>
    <script type="text/javascript">
      (function () {
        let amis = amisRequire('amis/embed');
        let amisJSON = {
  "type": "page",
  "data": {
    "arr": [
      {
        "a": "收入",
        "b": 199
      },
      {
        "a": "支出",
        "b": 299
      }
    ]
  },
  "body": [
    {
      "type": "tabs",
      "source": "${arr}",
      "tabs": [
        {
          "title": "${a}",
          "body": {
            "type": "tpl",
            "tpl": "金额:${b|number}元"
          }
        }
      ]
    },


{
                    "type": "operation",
                    "label": "操作",
                    "buttons": [
                          
                      {
                        "label": "复制",
                        "type": "button",
                      
                     
                      }
                    ]
                  }  


  ]
};

   
        let amisScoped = amis.embed('#root', amisJSON);
      })();
    </script>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the embedded amisJSON schema, especially the tabs body and the operation button. Determine how the selected tab's rendered text can be obtained and passed to the clipboard; done means selecting either tab and copying its corresponding rendered text, such as “金额:199元” or “金额:299元”.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.