-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
配置範例如下 (使用官方參考的配置聯動2 + Array 形式)
import { Context, Schema } from 'koishi'
export const name = 'test'
export interface ConfigRef {
shared: string
type: 'foo' | 'bar' | 'baz'
value?: number
text?: string
}
export interface Config {
configs: ConfigRef[]
}
export const Config: Schema<Config> = Schema.object({
configs: Schema.array(Schema.intersect([
Schema.object({
shared: Schema.string(),
type: Schema.union(['foo', 'bar', 'baz']).required(),
}).description('基础配置'),
Schema.union([
Schema.object({
type: Schema.const('foo').required(),
value: Schema.number().default(114514),
}).description('特殊配置 1'),
Schema.object({
type: Schema.const('bar').required(),
text: Schema.string(),
}).description('特殊配置 2'),
Schema.object({} as any)
])
]))
})
export function apply(ctx: Context) {
// write your plugin here
}使用後,按下 添加項目 沒有反應且在 F12 console 出現如下報錯:
此問題只在 dev 出現,build好後從koishi市場下載插件,則沒有這個問題
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
