命令是一个带有额外功能的函数 A Command is a function with an extra
canExecute observable 属性来判断命令是否可以执行。执行时,命令函数将检查 observable property to determine whether the command can be executed. When executed, a Command function will check the value of canExecute 如果为假则抛出。该类型描述了一个接口,并不打算直接实例化。参见 and throw if false. This type describes an interface and is not intended to be instantiated directly. See createCommand 从函数创建命令。 to create a command from a function.
成员 Members
afterExecute : Event
获取命令执行后引发的事件,该事件以命令的返回值作为其唯一参数引发。 Gets an event which is raised after the command executes, the event is raised with the return value of the command as its only parameter.
-
默认值: Default Value:
undefined
beforeExecute : Event
获取在命令执行之前引发的事件,该事件由包含两个属性的对象引发: Gets an event which is raised before the command executes, the event is raised with an object containing two properties: a
cancel 属性,如果侦听器将其设置为 false 将阻止执行命令,并且 property, which if set to false by the listener will prevent the command from being executed, and an args 属性,它是传递给命令的参数数组。 property, which is the array of arguments being passed to the command.
-
默认值: Default Value:
undefined
获取当前是否可以执行该命令。这个性质是可以观察到的。 Gets whether this command can currently be executed. This property is observable.
-
默认值: Default Value:
undefined
