2👍
You named your props titleTest
and textTest
, that means you need to pass title-test
and text-test
, NOT title
and data-test
.
The reason they end up in your main <div>
is because when Vue doesn’t recognise them as props (because you used different names), it falls back on assuming they’re regular HTML attributes (like class
, id
, and style
)
In order for it to work, you either need to rename your props to title
and dataTest
in Component1, or you should use the title-test
and text-test
names in Component2.
1👍
You just need pass props to the component1
<component1 ref="component1" :title-test="test1" :text-test="test2"></component1>
1👍
you are missnaming the props in the component1 ( child component ) , you used title
and data-test
but your props names are titleTest and textTest ! so you should use title-test
and text-test
instead .
:prop-name="propValue"