Skip to content

Instantly share code, notes, and snippets.

@nicolasblanco
Created July 9, 2017 15:59
Show Gist options
  • Save nicolasblanco/1ef5ecf7b2fc8322b71c295f4ee99d34 to your computer and use it in GitHub Desktop.
Save nicolasblanco/1ef5ecf7b2fc8322b71c295f4ee99d34 to your computer and use it in GitHub Desktop.
<script>
export default {
name: 'hello',
methods: {
removeProperty (productProperty) {
this.product_properties.splice(this.product_properties.indexOf(productProperty), 1)
},
addProperty () {
this.product_properties.push({ name: '', value: '' })
}
},
data () {
return {
product_properties: [
{ name: 'name 1', value: 'value 1' },
{ name: 'name 2', value: 'value 2' },
{ name: 'name 3', value: 'value 3' }
]
}
}
}
</script>
<template lang="pug">
.product-properties
div(v-for="product_property in product_properties")
input(type="text" v-model="product_property.name")
input(type="text" v-model="product_property.value")
button(@click="removeProperty(product_property)") -
button(@click="addProperty") +
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment