Thursday, June 24, 2021

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

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>
```

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMSz6bkKp7ckpvBis5NL_EwDoH_xE12va6NE7hd_M%2Be-jFHzog%40mail.gmail.com.

No comments:

Post a Comment