我有ParametrosEscaner
这样的课程:
export enum TiposPixel {
BlancoNegro = 0,
Grises,
Color
};
export class ParametrosEscaner {
tipoPixel: TiposPixel;
resolucion: number;
duplex: boolean;
mostrarInterfaz: boolean;
};
我有一个组件可以使用Input输入此类的实例:
@Input() parametrosActuales: ParametrosEscaner = new ParametrosEscaner();
constructor() { }
ngOnInit() {
debugger
if(this.parametrosActuales){
console.log(this.parametrosActuales);
this.interfaz = this.parametrosActuales.mostrarInterfaz;
this.dobleCara = this.parametrosActuales.duplex;
this.tipoSeleccionado = this.valoresEnum()[this.parametrosActuales.tipoPixel];
this.resolucionSeleccionada = this.parametrosActuales.resolucion;
}
}
问题是,即使我的控制台日志看起来像这样:
下面的所有属性都返回未定义的...我只是不明白为什么
编辑 发送对象的父组件如下所示:
ngOnInit() {
this._informacionPreferencias.preferenciasActuales.subscribe(pref => {
this.preferenciasCargaUsuario = pref;
debugger
if(this.preferenciasCargaUsuario.ParametrosEscaner){
this.parametrosEscaner = this.preferenciasCargaUsuario.ParametrosEscaner;
}
})
}
this.parametrosEscaner
是孩子接收的对象
答案 0 :(得分:0)
我认为您正在处理提到的[FunctionName("Function1")]
public async Task Run([TimerTrigger("0 */1 * * * *")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
var url = "http://localhost:7071/api/Durable_Starter";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.AutomaticDecompression = DecompressionMethods.GZip;
using (HttpWebResponse response = (HttpWebResponse) await request.GetResponseAsync())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
var html = reader.ReadToEnd();
log.LogInformation(html);
}
}
[FunctionName("Durable_Starter")]
public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")]HttpRequest req, [DurableClient] IDurableClient starter, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string instanceId = await starter.StartNewAsync("Durable_Orchestrator");
log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
var checkStatusResponse = starter.CreateCheckStatusResponse(req, instanceId);
return checkStatusResponse;
}
[FunctionName("Durable_Orchestrator")]
public async Task RunOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger log)
{
var message = await context.CallActivityAsync<string>("HelloWorld", "Thiago");
log.LogInformation(message);
}
[FunctionName("HelloWorld")]
public string HelloWorldActivity([ActivityTrigger] string name)
{
return $"Hello {name}!";
}
(yurzui)这类情况。
尝试:
Alexey