Skip to content

Commit

Permalink
Fix interactive docs for #2973
Browse files Browse the repository at this point in the history
  • Loading branch information
R0Wi committed Aug 11, 2022
1 parent b5a0d86 commit 8117bc8
Showing 1 changed file with 47 additions and 4 deletions.
51 changes: 47 additions & 4 deletions src/components/MultiselectTags/MultiselectTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->

<docs>
## Single tag selector
### Single tag selector

```vue
<template>
Expand All @@ -42,7 +42,7 @@ export default {
</script>
```

## Multiple tag selector
### Multiple tag selector
```vue
<template>
<div class="wrapper">
Expand All @@ -62,7 +62,7 @@ export default {
</script>
```

## Custom filter
### Custom filter
Because of compatibility reasons only 5 tag entries are shown by default. If you want to show all available tags set the `filter` function-prop to `null`:
```vue
<template>
Expand All @@ -71,16 +71,59 @@ Because of compatibility reasons only 5 tag entries are shown by default. If you
{{ value }}
</div>
</template>

<script>
export default {
data() {
return {
value: [1, 2, 3, 4, 5, 6]
}
}
}
</script>
```

It's also possible to apply any custom filter logic by setting the `filter` function-prop to any custom function receiving the tag element and the index:
```vue
<template>
<div class="wrapper">
<MultiselectTags v-model="value" :filter="(element, index) => element.id > 2 && element.displayName !== '' && element.canAssign && element.userAssignable && element.userVisible" />
<MultiselectTags v-model="value" :filter="(element, index) => element.id >= 2 && element.displayName !== '' && element.canAssign && element.userAssignable && element.userVisible" />
{{ value }}
</div>
</template>

<script>
export default {
data() {
return {
value: [
// This is the structure how data is usually returned by the server
{
id: 1,
displayName: 'Number1',
canAssign: true,
userAssignable: true,
userVisible: true
},
{
id: 2,
displayName: 'Number2',
canAssign: true,
userAssignable: true,
userVisible: true
},
{
id: 3,
displayName: 'Number3',
canAssign: true,
userAssignable: true,
userVisible: false
},
]
}
}
}
</script>
```
</docs>

Expand Down

0 comments on commit 8117bc8

Please sign in to comment.