My slices show as <Index> in the Vue Inspector rather than a readable name. Why? How do I name them?

Before slicemachine when I made files in /components they show niceley with their names.
And automatic slices provided by you folks also show nice names.
Why do my slices that I create with $ prismic sm --create-slice show as <Index>?
How can I name them?

(I'm using Nuxt)

Hello @online,

Thank you for reaching out. This is because all component files created with Slicemachine are simply named index.vue, so you will need to add a property "name", when registering the vue component.

For example:

<script>
export default {
  name: 'TestSlice',
  props: {
    slice: {
      type: Object,
      required: true,
      default() {
        return {}
      }
    }
  },
}
</script>

Thanks.

Great that fixed it. Thanks much easier to debug now :slight_smile:

Features request: Please enhance prismic sm --create-slice so that it also adds the name as part of slice creation.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.