小编BHU*_*MAR的帖子

是什么让这个Dart中的固定长度列表?

 List<String> checkLength(List<String> input) {
  if (input.length > 6) {
    var tempOutput = input;
    while (tempOutput.length > 6) {
      var difference = (tempOutput.length/6).round() + 1;
      for (int i = 0; i < tempOutput.length - 1; i + difference) {
        tempOutput.removeAt(i); //Removing the value from the list
      }
    }
    return tempOutput; //Return Updated list
  } else {
    return input;
  }
}
Run Code Online (Sandbox Code Playgroud)

我试图从临时列表中删除一些东西.为什么不起作用?我没有看到它是如何修复的,在我解决的其他问题中,我使用了类似的方法并且它有效(甚至相同)

请注意我对Dart有点新意,所以请原谅我这样的问题,但我无法弄清楚解决方案.

查找Dart Link中提供的代码

Dart中的代码

algorithm list dart

8
推荐指数
1
解决办法
4573
查看次数

React-JS 将 CSS-in-JS 转换为 CSS 字符串

在 React 项目中,最终用户可以使用工具生成 CSS。

我找到了如何生成 JS 对象并将其传递给style={}属性,但我想将生成的 JS 对象转换为 CSS 字符串,以便我可以保存它并在其他地方使用它。

我想将 JSObject 转换为 CSS:

JSObject [示例 - 输入]

JSObject: {
  lineHeight: 1,
  fontSize: 15,
  padding: 0,
  margin: 0,
  msBoxShadow: '0 0 1px 1px #000',
  MozBoxShadow: '0 0 1px 1px #000',
  OBoxShadow: '0 0 1px 1px #000',
  WebkitBoxShadow: '0 0 1px 1px #000',
  boxShadow: '0 0 1px 1px #000'
}
Run Code Online (Sandbox Code Playgroud)

预期的 CSS [示例 - 输出]

.cssClass{
    line-height: 1;
    font-size: 15px;
    padding: 0px;
    margin: 0px;
    box-shadow: rgb(0, 0, 0) …
Run Code Online (Sandbox Code Playgroud)

javascript css reactjs

3
推荐指数
1
解决办法
2720
查看次数

标签 统计

algorithm ×1

css ×1

dart ×1

javascript ×1

list ×1

reactjs ×1