The name property of the component has changed after vue+ts uses vue-class-component to write the component package!

uses a vue family bucket + typescript+electron development project

layout.vue
clipboard.png



feels that the code should be compressed when packing, and the name value should also be compressed by the way. There was no problem with writing name before, but there was a problem when I was on ts,name. Do you know how to solve it? The name field of the component plays a very important role in this project, and other alternatives also exist, but it is troublesome and a lot of code needs to be refactored!

May.09,2022

add the name attribute here clipboard.png


I encountered this problem when registering global components, so that none of the customized global components were rendered after packaging. At this time, the component was not instantiated and could not get $options. Later, it was solved by setting the name of a static property, which can be obtained at any time:

export default class CompGrid extends Vue {
  static ComponentName = 'comp-grid';
}

when needed:

Vue.component(CompGrid.ComponentName, CompGrid);
< hr >

component.options.name better solution of Jyx


you can use component.options.name

https://github.com/vuejs/vue-...


excuse me, what should I do if the packaged component is too large?

Menu