jsdoc-vuejs icon indicating copy to clipboard operation
jsdoc-vuejs copied to clipboard

Enable use of mixins

Open turboteddy opened this issue 6 years ago • 0 comments

Based on comment by @Kocal , I experimented a little bit. I have now knowledge of the inner workings of jsDoc, so this is just a "nudge to look in the right direction".

Works with code like this

/**
 * Description 
 * @mixin   someMixin
 * @vue-computed {*}           comp1              DOCUMENT ME!
 * @vue-computed {*}           comp2              DOCUMENT ME!
 */
export default {

  computed: {
    ...mapGetters([
      'comp1',
      'comp2'
    ])
  },

  methods: {

    /**
     * DOCUMENT ME!
     * @param a
     * @param b=null
     * @returns {*}
     */
    foo(a,b=null) {
        //....
    }
  }
};

...and corresponding module that uses this mixin:

/**
 * Description 
* @module components/someModule
 * @mixies   someMixin
 * @vue-computed {*}           comp3              DOCUMENT ME!
 * @vue-computed {*}           comp4              DOCUMENT ME!
 */
export default {
  name: 'someModuleName',
  mixins: [LanguageKeysMixin]
  // ....
};

However, this hack needs to be improved upon, because...

  • Only mixins with componentName ending with "Mixin" work
  • name of mixin cannot be prefixed with "something/"

Also, it would be nice to have the members that have been mixed into module components/someModule to be displayed for that module.

turboteddy avatar Jan 11 '19 13:01 turboteddy