- Notifications
You must be signed in to change notification settings - Fork 432
add tsx render function example #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "presets": [ | ||
| ["env", { | ||
| "modules": false | ||
| }] | ||
| ], | ||
| "plugins": ["transform-vue-jsx","transform-decorators-legacy"] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import Vue from 'vue' | ||
| import Component from '../lib/index' | ||
| | ||
| @Component({ | ||
| props:{ | ||
| title:{ | ||
| type:String, | ||
| required:true | ||
| } | ||
| } | ||
| }) | ||
| export default class World extends Vue { | ||
| title:string | ||
| content:string = 'default content' | ||
| get computedContent () { | ||
| return 'computed ' + this.content | ||
| } | ||
| | ||
| clearContent() { | ||
| this.content = '' | ||
| } | ||
| render(h) { | ||
| return <div > | ||
| <h1>{this.title}</h1> | ||
| ||
| <input type="text" value={this.content} onInput={ (evt:Event)=> this.content = (evt.target as HTMLInputElement).value} /> | ||
| <p>content: {this.content} </p> | ||
| <p>computed content: {this.computedContent} </p> | ||
| <button onClick={this.clearContent}>Clear content</button> | ||
| </div> | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this preset and
transform-decorators-legacysince we already transpile the code by TypeScript. Can we remove them from babelrc?