Skip to content

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

Merged
merged 4 commits into from
Oct 12, 2017
Merged

chore(example): add child component #160

merged 4 commits into from
Oct 12, 2017

Conversation

xingoxu
Copy link
Contributor

@xingoxu xingoxu commented Oct 10, 2017

Add children component in example and tell devs how to use it.
Fix #94

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
Copy link
Member

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">
Copy link
Member

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()
Copy link
Member

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?

Copy link
Contributor Author

@xingoxu xingoxu Oct 12, 2017

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)

Copy link
Member

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
Copy link
Member

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 ?

Copy link
Contributor

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. ?

Copy link
Contributor Author

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.

Copy link
Member

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")

Copy link
Contributor Author

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 ?

Copy link
Member

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()
Copy link
Member

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 😄

@ktsn
Copy link
Member

ktsn commented Oct 12, 2017

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants