Fix javascript runtime errors

I could see a warning about duplicate keys on the `Chip` page, also
there seems to be a missing check if a param is null (I used a default).
This commit is contained in:
roschaefer 2019-08-15 15:46:29 +02:00
parent 3d41d811d2
commit 79a8fc5f5f
2 changed files with 12 additions and 12 deletions

View File

@ -202,7 +202,7 @@ export default {
}
return attributes
},
getAttributesFromComment(comment) {
getAttributesFromComment(comment = '') {
const attributes = {}
const optionsMatch = comment.match(/@options[ ]+(\S[ \S]*)\n/)
if (optionsMatch) {

View File

@ -32,16 +32,9 @@ A chip can be deletable.
v-for="(tag, index) in tags"
@remove="removeTag(index)"
removable
:key="tag">
{{ tag }}
</ds-chip>
<ds-chip
v-for="(tag, index) in tags"
@remove="removeTag(index)"
removable
color="primary"
:key="tag">
{{ tag }}
:key="index"
:color="tag.color">
{{ tag.label }}
</ds-chip>
</div>
</template>
@ -49,7 +42,14 @@ A chip can be deletable.
export default {
data() {
return {
tags: ['Dog', 'Cat', 'Duck']
tags: [
{label: 'Dog'},
{label: 'Cat'},
{label: 'Duck'},
{label: 'Mouse', color: "primary"},
{label: 'Bird', color: "primary"},
{label: 'Elephant', color: "primary"},
],
}
},
methods: {