很久以前,随着过时的浏览器(chrome38),人们可以制作盒子......
可以使用outline-color: invert选择与背景完全相反的颜色.
今天,这样一个伟大的功能不再存在了:(你有没有想过我只想展示背景相反颜色边框的盒子?
(今天chrome(39)计算outline-color: invert到outline-color:transparent.
在那之前outline-color: invert渲染到outline-color: rgb(255,255,255)黑色的地上.)
谢谢你的想法.
我有点暗示递归。我正在从API接收数据。看起来像这样:
const input = [
{ id: 'a', level: 0 },
{ id: 'b', level: 1 },
{ id: 'c', level: 1 },
{ id: 'd', level: 2 },
{ id: 'e', level: 1 },
{ id: 'f', level: 0 },
];
Run Code Online (Sandbox Code Playgroud)
我需要类似的东西
const out = [
{ id: 'a', nodes: [
{ id: 'b', nodes: [] },
{ id: 'c', nodes: [
{ id: 'd', nodes: [] },
] },
{ id: 'e', nodes: [] },
] },
{ …Run Code Online (Sandbox Code Playgroud)