rdunk / sanity-blocks-vue-component

[DEPRECATED] Vue component for rendering block content from Sanity
MIT License
71 stars 10 forks source link

How to know which type of list when using a custom list serializer? #16

Open huguestennier opened 3 years ago

huguestennier commented 3 years ago

I'm able to assign a vue component as a serializer for a list just fine, but which props is available to know if it the list type is bullet or numbers?

ehuelsda commented 3 years ago

I also have this issue

ehuelsda commented 3 years ago

Though I just figured out that the following works:

   list: (props) => {
          if (props.type === 'feature')
            return this.$createElement(
              'PortableTextFeatureList',
              null,
              props.children
            );

          const tag = props.type === 'bullet' ? 'ul' : 'ol';
          return this.$createElement(tag, null, props.children);
        }