2017-11-19 1 views
-3

Ich habe diese Vorlage aus diesem site: Nach dem Ausprobieren einige Vorlagen, waren sie in Ordnung. Doch der Versuch, diese bietet Vorlage heraus ist immer eine leere HTML-Rückkehr auf diesem Code:Warum eine leere HTML-Rückgabe

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="utf-8"> 
    <title>BotUI - Hello World</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 
    <link rel="stylesheet" href="https://unpkg.com/botui/build/botui.min.css" /> 
    <link rel="stylesheet" href="https://unpkg.com/botui/build/botui-theme-default.css" /> 
    <meta name="description" content="A hello world bot. A conversational UI built using BotUI."> 
    </head> 
    <body> 
    <div class="botui-app-container" id="hello-world"> 
     <bot-ui></bot-ui> 
    </div> 
    <script src="https://cdn.jsdelivr.net/vue/latest/vue.min.js"></script> 
    <script src="https://unpkg.com/botui/build/botui.js"></script> 
    <script> 
    var botui = new BotUI('hello-world'); 

    botui.message.add({ 
     content: 'Hello World from bot!' 
    }); 

    botui.message.add({ 
     human: true, 
     content: 'Hello World from human!' 
    }); 

    document.getElementById("hello-world").innerHTML = content; 
    </script> 

    </body> 
</html> 

Was könnte das Problem sein? Grüße

+1

Ganz einfach, weil die var 'content' nicht definiert ist –

Antwort

3

Die Vorlage funktioniert gut, das einzige Problem ist, dass Sie

document.getElementById("hello-world").innerHTML = content; 

folgende Zeile entfernen, muss ich nicht sicher bin, warum Sie diese Zeile hinzugefügt haben. Alle Nachrichten sollten über botui.message.add() Methode gerendert werden. BotUI wird Inhalte einfügen.

<!DOCTYPE html> 
 
<html> 
 
    <head> 
 
    <meta charset="utf-8"> 
 
    <title>BotUI - Hello World</title> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 
 
    <link rel="stylesheet" href="https://unpkg.com/botui/build/botui.min.css" /> 
 
    <link rel="stylesheet" href="https://unpkg.com/botui/build/botui-theme-default.css" /> 
 
    <meta name="description" content="A hello world bot. A conversational UI built using BotUI."> 
 
    </head> 
 
    <body> 
 
    <div class="botui-app-container" id="hello-world"> 
 
     <bot-ui></bot-ui> 
 
    </div> 
 
    <script src="https://cdn.jsdelivr.net/vue/latest/vue.min.js"></script> 
 
    <script src="https://unpkg.com/botui/build/botui.js"></script> 
 
    <script> 
 
    var botui = new BotUI('hello-world'); 
 

 
    botui.message.add({ 
 
     content: 'Hello World from bot!' 
 
    }); 
 

 
    botui.message.add({ 
 
     human: true, 
 
     content: 'Hello World from human!' 
 
    }); 
 

 
    // document.getElementById("hello-world").innerHTML = content; 
 
    </script> 
 

 
    </body> 
 
</html>

Verwandte Themen