-
If I create multiple components, each with its own function definition, e.g.: function Counter() {
return {
$template: '#template-counter',
count: 0,
inc() {
this.count++
},
mounted() {
console.log(`I'm mounted!`)
}
}
}
function Stats() {
return {
$template: '#template-stats',
items: 123,
label: 'ITEMS'
}
} How would I pass both of these to the createApp({Counter}).mount()
createApp({Stats}).mount() But that does not work. In my html view, I have: <div v-scope="Stats()"></div>
<div v-scope="Counter()"></div> |
Beta Was this translation helpful? Give feedback.
Answered by
stancl
Jul 14, 2021
Replies: 2 comments 1 reply
-
I got this working by doing this: <div id="stats" v-scope="Stats()"></div>
<div id="counter" v-scope="Counter()"></div> createApp({Counter}).mount('#counter')
createApp({Stats}).mount('#stats') Is this the best/optimal approach? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Does |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
go4cas
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does
createApp({ Counter, Stats }).mount()
not work?