我是Angular2/4的新手.我创建了一个带有输入字段的基本组件.用户输入将反映在绑定到用户输入的其他组件中.现在我想设置一个值更改的一般监听器.
我认为OnChanges钩子是完美的解决方案,但是从未调用过ngOnChanges方法.难道我做错了什么?
任何暗示赞赏......
import { Component, Input, SimpleChanges, OnChanges } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<input [(ngModel)]="name">
<input [(ngModel)]="name">
<h1>{{name}}</h1>
`,
})
export class AppComponent implements OnChanges {
@Input() name: String = "abc"
ngOnChanges(changes: SimpleChanges) {
// changes.prop contains the old and the new value...
console.log('on change', changes)
}
}
Run Code Online (Sandbox Code Playgroud) 嗨,电子爱好者!如何在 Mac M1/Apple Silicone (arm64) 上打包“darwin-x64”的电子应用程序?
这绝对是可能的,因为一个月前我有一台带有 M1 芯片的 MacBookPro,并且我正在使用 Electron Forge 进行封装。最终产品是“darwin-x64”应用程序。执行时,它在活动监视器中显示为“kind=intel”,我与运行良好的旧英特尔 Mac 的同事共享该应用程序。他们能够毫无问题地运行它。现在我使用的是配备 M1 的新 MacBookPro,我必须重新安装所有内容。现在,Electron Forge 输出了我的应用程序的 100%“arm64”版本。这是完美的,但我还必须在这台机器上打包一个英特尔版本。我在谷歌上搜索了几个小时,但没有任何运气。所以非常感谢任何帮助!
我的电子锻造配置不接受:
module.exports = {
"packagerConfig": {
"all": true,
"arch": "x64",
}
}
Run Code Online (Sandbox Code Playgroud)
我缺少什么?