Created
July 9, 2017 15:59
-
-
Save nicolasblanco/1ef5ecf7b2fc8322b71c295f4ee99d34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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