简体   繁体   English

如何使 DOM 元素可在 SAPUI5 应用程序上拖动?

[英]How to make DOM element draggable on SAPUI5 app?

I am using Sap Conversational AI on my SAPUI5 app via Webchat.我通过网络聊天在我的 SAPUI5 应用程序上使用 Sap Conversational AI。 I added Webchat script on my apps Component.js.我在我的应用程序 Component.js 上添加了网络聊天脚本。 It works fine but the chat icon covers the app's footer and I couldn't make it draggable.它工作正常,但聊天图标覆盖了应用程序的页脚,我无法使其可拖动。

Here is component.js code;这是 component.js 代码;

    if ( !document.getElementById("chat-bot" )) {
            var s = document.createElement("script");
            s.setAttribute("id", "chat-bot");
            s.setAttribute("src", "https://cdn.cai.tools.sap/webchat/webchat.js");
            document.getElementsByTagName('head')[0].appendChild(s);
        }
        s.setAttribute("channelId", "XXXXX-XXXX-XXXX-XXXXX-XXXXXXX");
        s.setAttribute("token", "XXXXXXXXXXXXXXXXXXXXXXXX");

And here how it looks:这是它的外观: 聊天图标覆盖页脚

Anyone knows how can I make it draggable or put the icon on the footer too?任何人都知道如何使它可拖动或将图标也放在页脚上?

I don't think this is possible as of now.我认为目前这是不可能的。 The chatbot button is included with the below-attached CSS.聊天机器人按钮包含在下面附加的 CSS 中。 Obviously overriding this style class you can move the button around but it's not suggestable.显然覆盖这个样式类,您可以移动按钮,但不建议这样做。

For your use case, you can try giving the class 'sapUiLargeMarginEnd' to the last footer button to shift the footer buttons to the left.对于您的用例,您可以尝试将“sapUiLargeMarginEnd”类提供给最后一个页脚按钮以将页脚按钮向左移动。

By inspecting the button we can see the following properties.通过检查按钮,我们可以看到以下属性。 If SAP would have provided it to be button integration it would have been easy for us to do the placement.如果 SAP 将其提供为按钮集成,我们将很容易进行放置。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM