diff --git a/packages/ranui/components/input/index.ts b/packages/ranui/components/input/index.ts index 33378ced9..a6959a3a1 100644 --- a/packages/ranui/components/input/index.ts +++ b/packages/ranui/components/input/index.ts @@ -19,6 +19,7 @@ function Custom() { 'type', 'icon', 'status', + 'onChange' ] } _container: HTMLDivElement @@ -253,9 +254,16 @@ function Custom() { }, }), ) + this.dispatchEvent( + new CustomEvent('Input', { + detail: { + value: this.value, + }, + }), + ) } /** - * @description: 增加change方法 + * @description: 增加change方法,同时兼容大小写的情况 */ change = () => { this.dispatchEvent( @@ -265,6 +273,13 @@ function Custom() { }, }), ) + this.dispatchEvent( + new CustomEvent('Change', { + detail: { + value: this.value, + }, + }), + ) } /** * @description: 增加focus方法 diff --git a/packages/ranui/index.html b/packages/ranui/index.html index 99c4a3464..ad92e0e79 100644 --- a/packages/ranui/index.html +++ b/packages/ranui/index.html @@ -1,7 +1,7 @@ - + @@ -47,15 +47,21 @@

Input

" > - + +

Preview

- choose file to previewchoose file to preview

message

信息提示 - 警告提示 + 警告提示 错误提示 - 成功提示 + 成功提示 成功提示 diff --git a/packages/ranuts/src/server/server.ts b/packages/ranuts/src/server/server.ts index 93f7a7ceb..87093e353 100644 --- a/packages/ranuts/src/server/server.ts +++ b/packages/ranuts/src/server/server.ts @@ -37,7 +37,7 @@ function ipv4(): string | undefined { } class Server { - stack: Array + middleware: Array ctx: Context constructor() { const req = new http.IncomingMessage(new Socket()) @@ -47,7 +47,7 @@ class Server { req, res, } - this.stack = [] + this.middleware = [] /** * @description: 添加中间件 */ @@ -56,10 +56,10 @@ class Server { if (!handle) { throw new Error('the use function has an incorrect argument') } - this.stack.push(handle) + this.middleware.push(handle) } listen(...args: any): http.Server { - const fn = compose(this.stack) + const fn = compose(this.middleware) const server = http.createServer((req, res) => { this.ctx.req = req this.ctx.res = res