Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义JS时出现问题 #647

Open
1 task done
Chun-QiuCC opened this issue Oct 17, 2024 · 1 comment
Open
1 task done

自定义JS时出现问题 #647

Chun-QiuCC opened this issue Oct 17, 2024 · 1 comment

Comments

@Chun-QiuCC
Copy link

Blessing Skin 版本

6.0.2

PHP 版本

8.1

出现问题时所使用的浏览器

Microsoft Edge

您正在使用的 Web Server

Nginx

您正在使用宝塔吗?

出现了什么问题?

我希望在仪表盘的 使用情况 下方插入一个卡片,但是在添加按钮时出现了问题,无法正常添加,前端会直接变成 "按钮文本",如图所示:
6f1ed4b8fb76f3c3e07aa99956e68927
6d17e66d49ad2d13b050ba159778328d
以下是我完整的JS文档:

    // 获取ID为'usage-box'的元素
    var usageBox = document.getElementById('usage-box');

    // 创建新的div元素
    var gameBox = document.createElement('div');
    gameBox.id = 'game-box'; // 设置新元素的ID

    // 在'usage-box'元素之后插入新的div元素
    usageBox.insertAdjacentElement('afterend', gameBox);

    var htmlContent = `
    <div class="card card-primary card-outline">
        <div class="card-header"><h3 class="card-title">整合包下载</h3></div>
        <div class="card-body"> 点击下方按钮下载整合包 </div>
        <div class="card-footer">
            <button class="btn btn-primary" draggable="true">下载整合包</button>
        </div>
        <!-- 你可以在这里添加更多的HTML元素和内容 -->
    </div>
`;

    // 使用innerHTML属性将HTML代码插入到'game-box'元素内
    gameBox.innerHTML = htmlContent;

错误日志

No response

重现步骤

管理面板 个性化 页面添加我在上方附加的JS代码后出现了该问题

@Chun-QiuCC
Copy link
Author

Chun-QiuCC commented Oct 17, 2024

好像除了a标签其它标签都会被忽略,已尝试 <br> <h1> <h2> <h3>等标签都会被忽略

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant