File tree Expand file tree Collapse file tree 7 files changed +48
-3
lines changed Expand file tree Collapse file tree 7 files changed +48
-3
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "plugins" : [" transform-vue-jsx" ]
3
+ }
Original file line number Diff line number Diff line change 7
7
<p >computed msg: {{computedMsg}}</p >
8
8
<button @click =" greet" >Greet</button >
9
9
<hello ref =" helloComponent" ></hello >
10
+ <World />
10
11
</div >
11
12
</template >
12
13
13
14
<script lang="ts">
14
15
import Vue from ' vue'
15
16
import Component from ' ../lib/index'
16
17
import Hello from ' ./Hello.vue' ;
18
+ import World from ' ./World.tsx'
17
19
18
20
@Component ({
19
21
props: {
20
22
propMessage: String
21
23
},
22
24
components: {
23
- Hello
25
+ Hello ,
26
+ World
24
27
}
25
28
})
26
29
export default class App extends Vue {
@@ -33,6 +36,7 @@ export default class App extends Vue {
33
36
// use prop values for initial data
34
37
helloMsg: string = ' Hello, ' + this .propMessage
35
38
39
+
36
40
// lifecycle hook
37
41
mounted () {
38
42
this .greet ()
Original file line number Diff line number Diff line change
1
+ import Vue , { CreateElement } from 'vue'
2
+ import Component from '../lib/index'
3
+
4
+ @Component
5
+ export default class World extends Vue {
6
+
7
+ render ( h : CreateElement ) {
8
+ return < h1 > tsx render function </ h1 >
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ import Vue , { VNode } from "vue" ;
2
+ declare global {
3
+ namespace JSX {
4
+ interface Element extends VNode { }
5
+ interface ElementClass extends Vue { }
6
+ interface IntrinsicElements {
7
+ [ elem : string ] : any ;
8
+ }
9
+ }
10
+ }
Original file line number Diff line number Diff line change 10
10
"experimentalDecorators" : true ,
11
11
"strict" : true ,
12
12
"noUnusedLocals" : true ,
13
- "noUnusedParameters" : true
13
+ "noUnusedParameters" : true ,
14
+ "jsx" : " react" ,
15
+ "jsxFactory" : " h"
14
16
},
15
17
"include" : [
16
18
" ./**/*.ts"
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ module.exports = {
5
5
filename : 'build.js'
6
6
} ,
7
7
resolve : {
8
- extensions : [ '.ts' , '.js' ]
8
+ extensions : [ '.ts' , '.js' , 'tsx' ]
9
9
} ,
10
10
module : {
11
11
rules : [
@@ -17,6 +17,18 @@ module.exports = {
17
17
appendTsSuffixTo : [ / \. v u e $ / ]
18
18
}
19
19
} ,
20
+ {
21
+ test : / \. t s x $ / ,
22
+ exclude : / n o d e _ m o d u l e s | v u e \/ s r c / ,
23
+ loader :[
24
+ {
25
+ loader : "babel-loader"
26
+ } ,
27
+ {
28
+ loader : "ts-loader" ,
29
+ }
30
+ ]
31
+ } ,
20
32
{
21
33
test : / \. v u e $ / ,
22
34
loader : 'vue-loader' ,
Original file line number Diff line number Diff line change 39
39
"@types/chai" : " ^4.0.1" ,
40
40
"@types/mocha" : " ^2.2.41" ,
41
41
"babel-core" : " ^6.25.0" ,
42
+ "babel-helper-vue-jsx-merge-props" : " ^2.0.3" ,
42
43
"babel-loader" : " ^7.1.1" ,
44
+ "babel-plugin-syntax-jsx" : " ^6.18.0" ,
43
45
"babel-plugin-transform-class-properties" : " ^6.24.1" ,
44
46
"babel-plugin-transform-decorators-legacy" : " ^1.3.4" ,
47
+ "babel-plugin-transform-vue-jsx" : " ^3.5.0" ,
48
+ "babel-preset-env" : " ^1.6.1" ,
45
49
"babel-preset-es2015" : " ^6.24.1" ,
46
50
"chai" : " ^4.0.2" ,
47
51
"css-loader" : " ^0.28.4" ,
You can’t perform that action at this time.
0 commit comments