createCommand(func, canExecute) Widgets/createCommand.js 20 从给定的函数创建一个命令(Command),用于ViewModels。 命令是一个带有额外canExecute可观察属性的函数,以确定该命令是否可以执行。 执行时,命令函数会检查canExecute的值,如果为false则抛出。 它还提供了命令已经执行或即将执行的事件。 Name Type Default Description func function 要执行的函数。 canExecute Boolean true optional 指示函数当前是否可以执行的布尔值。