Javascript 删除ReactiveDict值
这就是我定义某个ReactiveDict变量的方式:Javascript 删除ReactiveDict值,javascript,meteor,Javascript,Meteor,这就是我定义某个ReactiveDict变量的方式: this.templateDictionary = new ReactiveDict(); this.templateDictionary.set( 'type', type ); this.templateDictionary.set( 'size', size ); this.templateDictionary.set( 'bgcolor', bgcolor ); this.templateDictionary.set( 'color
this.templateDictionary = new ReactiveDict();
this.templateDictionary.set( 'type', type );
this.templateDictionary.set( 'size', size );
this.templateDictionary.set( 'bgcolor', bgcolor );
this.templateDictionary.set( 'color', color );
现在我要删除所有内容:
this.templateDictionary.set( 'type', undefined );
this.templateDictionary.set( 'size', undefined );
this.templateDictionary.set( 'bgcolor', undefined );
this.templateDictionary.set( 'color', undefined );
但是如果我执行console.log,我会看到变量获取字符串未定义
。所以它并没有真正被移除
顺便问一下:一行可以设置多个值吗?您需要的是:
this.templateDictionary.delete('type');
虽然打印出来仍会显示未定义的,
,但这是正常的
要删除字典中的所有键,请执行以下操作:
this.templateDictionary.clear();
有关
ReactiveDict
中所有函数的列表,.如何删除此ReactiveDict中保存的所有值?啊,是的!清楚是你想要的。答案再次编辑!删除删除一个键,清除所有键