How to write a v-if condition for comparing django accessed value "{{cust_package}}" and vue.js "<%radio_price%>"

3 views
Skip to first unread message

Salima Begum

unread,
Jun 24, 2021, 9:36:23 AM6/24/21
to django...@googlegroups.com
And here I am trying to write if  statement and also I have interpolated a value in vue.js like "{{cust_package}}" accessed In django and <%radio_price%> accessed in vue.js for both i am trying to write a if condition like
"v-if="radio_price == {{cust_package}}" So this condition is not working so How can we write condition for both django and vue.js. The main issue is i want to write a if condition for both accessed value in django and vue.js I want to compare both the value by using v-if


Django backend code
```
return render(request, 'postad.html', {'user_type': user_type,
                                       'cust_package': cust_package,
                                       'package_value': price_value,
                                       'cust_package_ads': cust_package_ads})
```


from above code I have accessed cust_package into below template. And here I am trying to write if  statement and also I have interpolated a value in vue.js like "{{cust_package}}" accessed In django and <%radio_price%> accessed in vue.js for both i am trying to write a if condition like
"v-if="radio_price == {{cust_package}}" So this condition is not working so How can we write condition for both django and vue.js
```

<div>
   <div>
      <p>
       <input type="radio" name="price_Ads_package" class="price_1"v-model="radio_price"
       value="$2.99 - 6 Ads - Month"><span class="radio_price"> $2.99 - 6 Ads/Month</span>
      </p>

      <p>
       <input class="price2" type="radio" v-model="radio_price" name="price_Ads_package" class="price_1"
       value="$4.99 - 12 Ads - Month"><span class="radio_price"> $4.99 - 12 Ads/Month</span>
      </p>
   </div>
</div>

{{cust_package}}
<%radio_price%>
*here I am trying to compare django and vue.js accessed Value using v-if directive*
<div v-if="radio_price == {{cust_package}}">
    <button class="proceed_checkout" v-on:click.prevent="submitForm">submit</button>
</div>
```
Reply all
Reply to author
Forward
0 new messages