嵌入一言

· 2023-02-23

<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="yiyan"></div>
    <script>
        fetch('https://v1.hitokoto.cn/')
            .then(response => response.json())
            .then(data => {
                const {
                    hitokoto,
                    from,
                    from_who
                } = data
                document.getElementById('yiyan').innerHTML = `${hitokoto} 《${from}》 ${from_who}`
            });
    </script>
</body>

</html>
Theme Jasmine by Kent Liao