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 77 <p >computed msg: {{computedMsg}}</p >
88 <button @click =" greet" >Greet</button >
99 <hello ref =" helloComponent" ></hello >
10+ <World />
1011 </div >
1112</template >
1213
1314<script lang="ts">
1415import Vue from ' vue'
1516import Component from ' ../lib/index'
1617import Hello from ' ./Hello.vue' ;
18+ import World from ' ./World.tsx'
1719
1820@Component ({
1921 props: {
2022 propMessage: String
2123 },
2224 components: {
23- Hello
25+ Hello ,
26+ World
2427 }
2528})
2629export default class App extends Vue {
@@ -33,6 +36,7 @@ export default class App extends Vue {
3336 // use prop values for initial data
3437 helloMsg: string = ' Hello, ' + this .propMessage
3538
39+
3640 // lifecycle hook
3741 mounted () {
3842 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 1010 "experimentalDecorators" : true ,
1111 "strict" : true ,
1212 "noUnusedLocals" : true ,
13- "noUnusedParameters" : true
13+ "noUnusedParameters" : true ,
14+ "jsx" : " react" ,
15+ "jsxFactory" : " h"
1416 },
1517 "include" : [
1618 " ./**/*.ts"
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ module.exports = {
55 filename : 'build.js'
66 } ,
77 resolve : {
8- extensions : [ '.ts' , '.js' ]
8+ extensions : [ '.ts' , '.js' , 'tsx' ]
99 } ,
1010 module : {
1111 rules : [
@@ -17,6 +17,18 @@ module.exports = {
1717 appendTsSuffixTo : [ / \. v u e $ / ]
1818 }
1919 } ,
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+ } ,
2032 {
2133 test : / \. v u e $ / ,
2234 loader : 'vue-loader' ,
Original file line number Diff line number Diff line change 3939 "@types/chai" : " ^4.0.1" ,
4040 "@types/mocha" : " ^2.2.41" ,
4141 "babel-core" : " ^6.25.0" ,
42+ "babel-helper-vue-jsx-merge-props" : " ^2.0.3" ,
4243 "babel-loader" : " ^7.1.1" ,
44+ "babel-plugin-syntax-jsx" : " ^6.18.0" ,
4345 "babel-plugin-transform-class-properties" : " ^6.24.1" ,
4446 "babel-plugin-transform-decorators-legacy" : " ^1.3.4" ,
47+ "babel-plugin-transform-vue-jsx" : " ^3.5.0" ,
48+ "babel-preset-env" : " ^1.6.1" ,
4549 "babel-preset-es2015" : " ^6.24.1" ,
4650 "chai" : " ^4.0.2" ,
4751 "css-loader" : " ^0.28.4" ,
You can’t perform that action at this time.
0 commit comments