Skip to content

@koshijs/core 中的 internal/validate 有用吗? #582

Answered by DGCK81LNN
DGCK81LNN asked this question in Q&A
Discussion options

You must be logged in to vote

我明白了,原来默认是不检查

ctx.command(def, desc?, config?)

  • config: CommandConfig 指令的配置
    • checkUnknown: boolean 是否对未知选项进行检测,默认为 false
    • checkArgCount: boolean 是否对参数个数进行检测,默认为 false
    • authority: number 最低调用权限,默认为 1
    • showWarning: boolean 当小于最短间隔时是否进行提醒,默认为 false

这个指南里目前好像没有写,我之前一直没有注意到。

因为是内置插件,会自动注册,所以不需要导出。

import validate from './internal/validate'

this.plugin(validate)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@shigma
Comment options

Answer selected by DGCK81LNN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants