-
Notifications
You must be signed in to change notification settings - Fork 433
chore(example): add child component #160
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
Conversation
README.md
Outdated
@@ -48,6 +48,9 @@ import Component from 'vue-class-component' | |||
} | |||
}) | |||
export default class App extends Vue { | |||
// props are had to declare again | |||
propMessage: string |
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.
The example in this readme is not written in typescript. So we should not include types.
example/App.vue
Outdated
@@ -6,19 +6,25 @@ | |||
<p>helloMsg: {{helloMsg}}</p> | |||
<p>computed msg: {{computedMsg}}</p> | |||
<button @click="greet">Greet</button> | |||
<hello ref="helloComponent"> |
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.
Missing closing tag 👀
@@ -40,6 +46,12 @@ export default class App extends Vue { | |||
// method | |||
greet () { | |||
alert('greeting: ' + this.msg) | |||
this.$refs.helloComponent.sayHello() |
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 think this causes compile error since all .vue
files declared as Vue
.
Did this example work in your machine?
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.
@ktsn helloComponent is decalred as Hello (see line 54)
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.
Oh, I thought Hello
should be also typed as typeof Vue
because we has sfc.d.ts
. But actually webpack resolves actual type. I didn't know that 😄
example/App.vue
Outdated
} | ||
}) | ||
export default class App extends Vue { | ||
// props are had to declare again |
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.
props had to be declared again
?
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.
How about You have to declare props again.
?
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.
Though the prop
option in @Component
is not a declaration, I think it is necessary to tell the starter why we have to declare propMessage
again.
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.
Doesn't it grammatically invalid that props are had to
? I think we usually say props have to be
in that case (sorry, my previous comment should be "have" instead of "had")
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.
Yes, my fault. 😆 I'll fix it now.
props have to be declared for typescript
Is it nicer or not ?
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.
Yeah, it looks great 👍
@@ -40,6 +46,12 @@ export default class App extends Vue { | |||
// method | |||
greet () { | |||
alert('greeting: ' + this.msg) | |||
this.$refs.helloComponent.sayHello() |
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.
Oh, I thought Hello
should be also typed as typeof Vue
because we has sfc.d.ts
. But actually webpack resolves actual type. I didn't know that 😄
Thank you! |
Add children component in example and tell devs how to use it.
Fix #94