月度归档:2024年07月

layui表格换行

<style>
    .layui-table-cell {
        height: auto;
        overflow: auto;
        text-overflow: initial;
        white-space: normal;
    }
</style>
去掉按钮的下边距
.layui-table .layui-btn-container .layui-btn {
margin-bottom: 0;
}

js复制文本到剪贴板

https://developer.mozilla.org/zh-CN/docs/Web/API/Clipboard/writeText


    function copyText(text) {
        if (navigator.clipboard) {
            navigator.clipboard.writeText(text).then(
                function () {
                    /* clipboard successfully set */
                },
                function () {
                    /* clipboard write failed */
                },
            );
        } else {
            let oInput = document.createElement('input');
            oInput.value = text;
            document.body.appendChild(oInput);
            oInput.select();
            document.execCommand("Copy");
            oInput.className = 'oInput';
            oInput.style.display = 'none';
        }
    }

    function oCopy(text) {
        copyText(text)
        layer.msg('复制成功!')
    }