P
P
profcat2020-11-11 20:59:55
Vue.js
profcat, 2020-11-11 20:59:55

How to naming Vue components in one word?

Hey! Actually, most often you want to name the components in the project in one word without a boilerplate. If there is a Menu, name it not VMenu, not MenuItem, not TheMenu, not MenuComponent. Perhaps there is some kind of lib, extension, maybe you can tell me where to pick to make the code prettier.

I understand why multi-word naming is needed, and let it be used inside the collector, but the project does not affect

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2020-11-11
@Aetae

The tag menuis in the html spec, although it seems to be deprecated, but nothing prevents you from using unreserved names. Well, or if you really want to, you can kill registered tags
at your own peril and risk :

Vue.config.isReservedTag = function(isReservedTag){
  const allowedTags = ['menu'];
  return function(tag) {
    if(allowedTags.includes(tag)) return false;
    return isReservedTag.call(this, tag);
  }
}(Vue.config.isReservedTag);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question