Skip to content

Commit cb08e8f

Browse files
committed
构建: change rts2
1 parent 09fcb69 commit cb08e8f

File tree

2 files changed

+10
-47
lines changed

2 files changed

+10
-47
lines changed

example/main.tsx

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,25 @@
11
import '@abraham/reflection'
22
import { Component, VueComponent } from 'vue3-oop'
3-
import { Inject, InjectionToken, SkipSelf } from 'injection-js'
43
import { createApp } from 'vue'
54
import './theme/app.css'
6-
import { focusDirective } from './focus.directive'
75
import { CountService } from './count.service'
86

9-
const TOKEN1 = new InjectionToken('TOken')
10-
11-
abstract class A {
12-
name = 1
13-
}
14-
15-
@Component({
16-
providers: [
17-
{ provide: TOKEN1, useValue: 1 },
18-
{ provide: A, useValue: { age: 19 } },
19-
{ provide: 'aa', useValue: 1, multi: true },
20-
{ provide: 'aa', useValue: 2, multi: true },
21-
],
22-
})
7+
@Component()
238
class Home extends VueComponent {
24-
static directives = {
25-
focus: focusDirective,
26-
}
27-
constructor(
28-
@Inject(TOKEN1) private a: any,
29-
private c: CountService,
30-
private d: A,
31-
@Inject('aa') private e: number[],
32-
) {
9+
constructor(private countService: CountService) {
3310
super()
34-
console.log(a, c, d, e)
3511
}
3612

3713
render() {
3814
return (
39-
<div>
40-
111122222ccc
41-
<HomeChild></HomeChild>
15+
<div style={{ textAlign: 'center' }}>
16+
<h2>count: {this.countService.count}</h2>
17+
<button onClick={() => this.countService.add()}>+</button>
18+
<button onClick={() => this.countService.remove()}>-</button>
4219
</div>
4320
)
4421
}
4522
}
4623

47-
@Component()
48-
class HomeChild extends VueComponent {
49-
constructor(
50-
private countService: CountService,
51-
@SkipSelf() private countService1: CountService,
52-
@Inject(TOKEN1) private a: number,
53-
) {
54-
super()
55-
console.log(countService, countService1, countService === countService1)
56-
console.log(a)
57-
}
58-
59-
render() {
60-
return <div>2222</div>
61-
}
62-
}
63-
6424
const app = createApp(Home)
6525
app.mount('#app')

vite.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import { defineConfig } from 'vite'
22
import vueJsx from '@vue3-oop/plugin-vue-jsx'
33
import vue from '@vitejs/plugin-vue'
44
import typescript from 'rollup-plugin-typescript2'
5+
// import typescript from '@rollup/plugin-typescript'
56

67
export default defineConfig(({ command, mode }) => {
78
return {
8-
esbuild: false, // 不支持装饰器
9+
esbuild: {
10+
exclude: /\.tsx?$/,
11+
}, // 不支持装饰器
912
plugins: [typescript({ check: false }), vueJsx()],
1013
resolve: {
1114
alias: [

0 commit comments

Comments
 (0)