question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Name for component?

See original GitHub issue

Not sure if we are doing something wrong or is a bug on vue, let me explain:

When we create a component we usually add ‘Component’ to the name, for example: export class SwitchButtonBoxComponent extends SwitchButtonComponent {}

When we add this component to his parent the only way that we’ve found to change his tag name is:

@Component({
    components: {
        'switch-button-box': SwitchButtonBoxComponent
    }
})

We have to do that because we don’t want the ‘Component’ word on the tag name (I think is a normal thing)

But this is not the best scenario, we’ve tried that:

export class SwitchButtonBoxComponent extends SwitchButtonComponent {
     name: 'switch-button-box'
}

and on the other side

@Component({
    components: {
        SwitchButtonBoxComponent
    }
})

But is not working, is there any alternative or suggestion?

Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
eladcandroidcommented, Apr 30, 2018

Why can’t we use this approach? (taken from “vue-class-component”)

import Vue from “vue”; import Component from “vue-class-component”; @Component({ name: “AnotherName” }) export default class YourName extends Vue { }

1reaction
kaorun343commented, Jul 26, 2017

@CKGrafico

Hi.

Here is an explanation of name option. https://vuejs.org/v2/api/#name

Vue components don’t use it for defining their tag name, whereas Angular components do so.

Therefore, I recommend you to do like this below.

import SwitchButtonBox from './YourSwitchButtonComponentBoxPath'

@Component({
  components: {
    SwitchButtonBox
  }
}
})
export class YourComponent {
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

25 Synonyms & Antonyms for COMPONENT - Thesaurus.com
synonyms for component · basic · composing · fundamental · integral · elemental · inherent · intrinsic · part and parcel of ...
Read more >
What is another word for component? - WordHippo
What is another word for component? ; offshoot · rudiment ; parameter · article ; slab · clause ; criterion · constraint ;...
Read more >
Best 47 synonyms for component - Thesaurus - YourDictionary
Synonyms for COMPONENT: element, basic, composing, segment, unit, constituent, ingredient, regenerator, resistor, elemental, building block, piece, portion, ...
Read more >
Name and organize components - Figma Help Center
We recommend defining and documenting a component structure within your team or company. This will make it easier to find components in the...
Read more >
Component names - Striim
Components cannot be renamed. In the Flow Designer, you can copy a component and give it a new name.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found