有没有其他人在 Power Apps 组件框架 (PCF) 的初始化中看到未设置控件值的竞争条件?
我将如何进行测试?
加载表单时(在 UCI 中)我没有看到 API 调用?我确实在网格视图的批处理调用中看到了它,但一定不是吗?
这是我的代码:
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container: HTMLDivElement) {
this.context = context;
this.container = document.createElement("div");
this.container.setAttribute("class", "acgContainer")
this._refreshIndex = this.refreshIndex.bind(this);
this.notifyOutputChanged = notifyOutputChanged;
this.value = context.parameters.acgAriasYesNoUnControl.raw;
//console.log("the init value: ", this.value);
this.options = context.parameters.acgAriasYesNoUnControl.attributes?.Options;
//console.log(this.options);
this.selectElement = document.createElement("select");
this.selectElement.addEventListener('change', this._refreshIndex);
// @ts-ignore
var zeroEle = this.selectElement.appendChild(new Option("---", null));
zeroEle.style.backgroundColor = "#ffffff";
if (this.options) {
if (this.options.length > 0) {
this.options.map((option: ComponentFramework.PropertyHelper.OptionMetadata, index: number) => {
var ele = this.selectElement.appendChild(new Option(option.Label, option.Value.toString()));
ele.style.backgroundColor = "#ffffff";
if (option.Label === this.envYesValue) {
//console.log("green option: ", option.Value);
this.valueOfYes = option.Value;
}
if (this.value === option.Value) {
ele.dataset.selected = "true";
}
})
}
}
// @ts-ignore
this.selectElement.value = this.value?.toString() || null;
this.selectElement.setAttribute("class", "acgYesNoUnControl");
this.container.appendChild(this.selectElement);
container.appendChild(this.container);
//this.notifyOutputChanged();
}