0👍
The <p>
is not a child component, everything here is all in the same scope. You cannot refer to its attributes from its contents. As in Bert’s example, you simply have to put what you want in both places.
If you want to use a variable for the id
and for the contents, you can do that, but you have to explicitly put it in both places:
<p :id="myIdVariable">{{myIdVariable}}</p>
Source:stackexchange.com