Skip to content

Commit

Permalink
fix: hook装饰器未传递参数
Browse files Browse the repository at this point in the history
  • Loading branch information
agileago committed Apr 15, 2022
1 parent e5f4c8c commit 44f87a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion example/main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '@abraham/reflection'
import { Component, Mut, VueComponent } from 'vue3-oop'
import { Component, Hook, Mut, VueComponent } from 'vue3-oop'
import { createApp } from 'vue'
import 'ant-design-vue/dist/antd.css'
import { ConfigProvider, Layout, Menu } from 'ant-design-vue'
Expand All @@ -13,12 +13,20 @@ import { setup } from './setup'
class App extends VueComponent {
@Mut() collapsed = false

@Hook('ErrorCaptured')
error(...args: any[]) {
console.log(args)
}

render() {
return (
<ConfigProvider locale={zhCN}>
<Layout style={{ minHeight: '100vh' }}>
<Layout.Sider v-model:collapsed={this.collapsed} collapsible>
<h2
onClick={() => {
throw new Error('hahaha')
}}
style={{ color: '#fff', textAlign: 'center', lineHeight: '40px' }}
>
VUE 示例
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function handler(targetThis: any) {
break
}
doneLife[option] = true
vueFn(() => targetThis[item.key]())
vueFn((...args: any[]) => targetThis[item.key](...args))
}
}
}
Expand Down

0 comments on commit 44f87a0

Please sign in to comment.