js 使用execcommand 创建的标签 怎么添加类名或者样式

想给u 标签添加类名 吧下换线变出一点 或者 把他替换成span

 document.execCommand("underline", false, null);

<div data-v-6f09dd90="" id="InputBox" data-gramm="false" contenteditable="true" data-placeholder="问题、灵感、知识、信息等" class="ql-editor">我是第<u>一行</u><p><u>我是第二行</u></p><p><u>我是第三行</u></p></div>

execCommand这个api貌似作废了,建议换其它写法。

            const eles = document.getElementsByTagName("u");

            for (let index = 0; index < eles.length; index++) {
                const ele = eles[index];
                ele.classList = 'underline';
                ele.style = 'text-decoration:underline;'
            }