Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- language: lang-html -->
- <p>£{{plant_price}}</p>
- <div v-if="selected.plant.variations.length > 0 ">
- <select v-model="selected.plant.selected_variation" class="form-control">
- <!-- inline object literal -->
- <option v-for="(variation, i) in selected.plant.variations" :selected="variation.id == selected.plant.selected_variation ? 'selected' : ''":value="variation.id">
- {{variation.name}}
- </option>
- </select>
- </div>
- <!-- language: lang-js -->
- var app = new Vue({
- el: '#vueApp',
- data: {
- selected: {
- type: {a: '' , b: ''},
- vehicle: '',
- plant: {
- }
- },
- computed: {
- plant_price: function() {
- if (this.selected.plant.variations.length > 0 ) {
- var variant = _.find(this.selected.plant.variations, {id: this.selected.plant.selected_variation });
- return variant.price;
- } else {
- return this.selected.plant.price;
- }
- }
- ...
- selected:Object
- type:Object
- vehicle: "Truck"
- plant:Object
- id:26
- price:"52"
- regular_price:"100"
- selected_variation:421
- variations:Array[2]
- 0:Object
- id:420
- name:"small"
- price:52000
- regular_price:52000
- 1:Object
- etc...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement