question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Template for custom data rendering with nested keys

See original GitHub issue

Is 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:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Hiwscommented, Jun 16, 2021

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 in v-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

0reactions
stale[bot]commented, Apr 27, 2022

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found