javascript - 如何在打字稿中动态设置对象元素
问题描述
filterForElement: string
constructor(
private api: someApiService) { }
someInitFunction(params:any) {
this.filterForElement = params.filterForElement // Value is available onece component is initialize.
}
onChangeDrop() {
this.api.setFilterModel({'state': {filterType: "text", type: "equals", filter: valueToUse}})
}
这里不是我想用值替换的状态filterForElement
。
解决方案
试试这样:
this.api.setFilterModel({this.filterForElement: {filterType: "text", type: "equals", filter: valueToUse}})
推荐阅读
- c# - 如何在 c# 项目中使用 c++ dll
- chaos - 使用 Chaos 工具包在 Kubernetes 集群(AKS)中创建节点的实验
- java - 如何获取 android 12 时钟的应用程序 BottomNavigationView?
- c# - Polly 和 HttpClient 无限请求
- wordpress - 从内部 IP 锁定的 Wordpress 帐户
- google-cloud-platform - 谷歌云运行失败并出现“应用程序执行可能失败”错误
- flutter - 由于底层连接被关闭,调用被取消。Flutter 和 .netcore 3.1
- android - 让 Android Qt 应用程序在后台运行
- api - 如何在 Google Search Console API 查询中删除受 Google Local Pack 影响的关键字?
- typescript - 带有打字稿的 Vuex 模块