当我尝试在打字稿中使用toSorted方法时,如下所示:
const x = [1,2];
const y = x.toSorted();
Run Code Online (Sandbox Code Playgroud)
我收到此 ts 错误:
类型“number[]”上不存在属性“toSorted”。ts(2339)
toReverse () 和toSplice () 方法也会发生这种情况
我开始制作饼干横幅。为了尽可能简化我的问题,我将以下内容粘贴到 w3schools tryit 编辑器中:
<dialog open style="position:fixed;right:0;">
<button>Decline</button>
<button>Allow cookies</button>
</dialog>
Run Code Online (Sandbox Code Playgroud)
预期结果:它应该位于视口的右侧。实际结果:对话框位于视口中央。
当我编辑上面的内容以使用 div 而不是对话框时,它按预期工作:
<div style="position:fixed;right:0;">
<button>Decline</button>
<button>Allow cookies</button>
</div>
Run Code Online (Sandbox Code Playgroud)
按应有的方式转到视口的右侧。
如何从 HTML5 对话框标记中获取此行为?
感谢人们在这里所做的所有出色工作。