A
A
Arman2020-10-31 11:46:53
Django
Arman, 2020-10-31 11:46:53

Can I get data from the root tag?

<div id="vuejs-app" var1="a" var2="b">

I need attribute data a and b . I wrote props, looked in $root =(

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander, 2016-05-24
@kentuck1213

so request.path does not equal '/phylosophy'. I think the answer lies there {{ request.path }}

P
Pavel Aksenov, 2016-05-24
@hellmin

I think it's not good to hardcode urls, because there are {% url %}
And then there will be no such misunderstandings.

{% url 'phylosophy' as url %}
<a href='{{ url }}' {% if request.path == url %}class="active"{%endif %}>philosophy</a>

S
scream4ik, 2016-05-25
@scream4ik

Alternative via javascript https://css-tricks.com/snippets/jquery/add-active-...

D
Dmitry Belyaev, 2020-10-31
@Arik

Vue completely replaces the element it's initialized on, read the data through normal DOM api before vue is initialized

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question