Template for custom data rendering with nested keys
See original GitHub issueIs your feature request related to a problem? Please describe…
I have a b-table component with item provider function. The provider function returns the items and a “fields” array:
fields: [
{ key: "id", label: "user id", sortable: true },
{ key: "attributes.name", label: "user name", sortable: true },
{ key: "attributes.createdAt", label: "created at", sortable: true },
{ key: "attributes.permissions", label: "permissions", sortable: true },
],
The keys of the table are often nested.
Now I would like to create a template for custom data rendering. I tried something like this:
<!-- A custom formatted column -->
<template #cell(attributes.permissions)="data">
<b-badge variant="primary" class="mr-3" v-for="permission in data.attributes.permissions" :key="permission">
{{ permission }}
</b-badge>
</template>
But this does not work. I got the error message:
[vue/valid-v-slot]
'v-slot' directive doesn't support any modifier.eslint-plugin-vue
Describe the solution you’d like
Is there a possibility that nested keys work with templates for custom data rendering?
Describe alternatives you’ve considered
I also tried something like this which also does not work:
<template v-slot:[`attributes.permissions`]="{ data }">
<b-badge variant="primary" class="mr-3" v-for="permission in data.attributes.permissions" :key="permission">
{{ permission }}
</b-badge>
</template>
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Pass nested dictionary from views to template django
Is there a way to access nested dictionary in templates? I've tried from this answer bu doesn't show anything {% for key, value...
Read more >How can I do a nested template for:each in LWC for a map of ...
This post shows an example using nested templates to iterate over a map keys, and values in the nested template - does that...
Read more >Custom Component Nested Object · Issue #2172 · ngx-formly ...
My question was how to pass complex object (with nested keys) and process them on template level.
Read more >List Rendering - Vue.js
We can use the v-for directive to render a list of items based on an array. ... where items is the source data...
Read more >Table | Components - BootstrapVue
Table. For displaying tabular data, <b-table> supports pagination, filtering, sorting, custom rendering, various style options, events, and asynchronous ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What you’ve written is valid. (except the alternative as you’re missing
cell()
around your property path) However your linter is throwing a warning, and not an error. Which can stop your project from compiling. You’ll need to configure your linter to allow modifiers inv-slot
, check the following links as to how.https://eslint.vuejs.org/rules/valid-v-slot.html#vue-valid-v-slot https://eslint.vuejs.org/rules/valid-v-slot.html#options
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!