Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/431.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Can';t从字典中删除元素_Javascript_Dictionary_Polymer - Fatal编程技术网

Javascript Can';t从字典中删除元素

Javascript Can';t从字典中删除元素,javascript,dictionary,polymer,Javascript,Dictionary,Polymer,在我前面的问题之后:,我需要从字典中删除一个元素,当我在另一个自定义元素中导入此自定义元素时,该元素作为属性传递 流量元件 <script> Polymer({ is: 'flow-element', properties: { dict: { type: String, notify: true }, name: { type: String }, kind: { type: Strin

在我前面的问题之后:,我需要从字典中删除一个元素,当我在另一个自定义元素中导入此自定义元素时,该元素作为属性传递

流量元件

<script>
Polymer({
  is: 'flow-element',
  properties: {
    dict: {
      type: String,
      notify: true
    },
    name: {
      type: String
    },
    kind: {
      type: String
    }
  },

  handleClick: function() {
    console.log('clicked: ' + this.name);
    // the output does work
    console.log('Dict before ::' + JSON.stringify(this.dict, null, 4));

    // this does NOT work
    delete this.dict[this.name];

    // the output does work, but dictionary is unchanged
    console.log('Dict after ::' + JSON.stringify(this.dict, null, 4));

  }
});
</script>
<flow-element dict={{flowDictionnary}} name="{{item.first}}" kind="{{item.last}}"></flow-element>
之后


但是,显示dictionary元素的列表不会更新,元素将保留在屏幕上。

您已尝试使用此.splice(path,start,deleteCount)?
您必须按如下方式使用它:
this.拼接(“dict”,索引,1)
其中
索引
指要移除的元件的位置。
有关推送、弹出、拼接和其他聚合物有用功能的更多信息。

非常感谢。。。我还有一个问题:
{
    "first": "Bob",
    "last": "Smith"
}
{
    "first": "Sally",
    "last": "Johnson"
}
null,
{
    "first": "Sally",
    "last": "Johnson"
}