How to call template of mixins in vue-cli

in general vue writing, mixins can be mixed with template

var Foo = new Vue({
  template: `<div>

this is in Foo

</div>` }) var Bar = new Vue({ el: "-sharpapp", mixins: [Foo], created () { console.log(Foo) }, template: `<div>` + Foo.$options.template + `

others

</div>` })

output:
this is in Foo
others
you can run it in https://jsfiddle.net/once_ss/.

where Bar not only has its own template content (others), but also uses the template (this is in Foo) of Foo entered by mixins.

but this cannot be written in vue-cli.
if you write < template > < / template > in Bar.vue, then only this part of Bar"s template, will be displayed. If Bar.vue does not write < template > < / template > at all, then template content in Foo will be displayed.

that"s the problem. How do you display both Foo"s own template content and Bar"s own template content in vue-cli?

Sep.07,2021

this cannot be achieved through mixins. If the two values are the same, only the value of the current component will be retained. You can introduce foo into bar, as a component and then display

in bar.
Menu