我正在使用botman.io包进行chatboot小部件。
一切正常,但问题是我无法更改聊天小部件的默认背景颜色。在检查控制台上,它显示boman小部件调用(https://cdn.jsdelivr.net/npm/[email protected]/build/assets/css/chat.css)链接,但是我在我的localhost项目上找不到该调用。如果有人知道解决方案,我将不胜感激。

<script src="{{ asset('/js/webflow.js') }}"></script>
<script>
        var botmanWidget = {
        title:'Scarletbot',
        introMessage: 'Hello, I am a Scarlet! I am here to assist you and answer all your questions about our products and services!',
        mainColor:'#c02026',
        aboutText:'',
        bubbleBackground:'#c02026',
        headerTextColor: '#fff',
    };

</script>
<script id="botmanWidget" src="{{ asset('/js/widget.js') }}"></script>


javascript - 如何更改botman.io小部件的默认背景颜色-LMLPHP

最佳答案

您可以在中添加frameEndpoint

var botmanWidget = {
    frameEndpoint: '<?php echo base_url('botdemo/chatserver1');?>',
    title:'Scarletbot',
    introMessage: 'Hello, I am a Scarlet! I am here to assist you and answer all your questions about our products and services!',
    mainColor:'#c02026',
    aboutText:'',
    bubbleBackground:'#c02026',
    headerTextColor: '#fff',
};


frameEndpoint不过是由botman-widget加载的iframe的来源

frameEndpoint源类似于:

<!doctype html>
<html>
<head>
    <title>BotMan Widget</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/assets/css/chat.min.css">
</head>
<body>
    <script id="botmanWidget" src='https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/chat.js'></script>
</body>
</html>


在这里,您也可以使用自己的CSS。

09-07 18:02