Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem that the vue component references another component and the component does not appear?

Shulou Source: shulou.com Published: 2022-05-31 22:44:33 09月21日 Update

This article mainly introduces the vue component reference another component does not show the problem of how to solve the relevant knowledge, the content is detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that after reading this vue component reference another component does not show the problem of how to solve the article will have a harvest, let's take a look at it.

Component referencing another component appears that the component does not display

Download a vue-built background management system, the navigation bar is a sidebar, want to add a navigation in the head

First, import the components to be used.

Import Hamburger from'@ / components/Hamburger'import Nav from'@ / components/Nav/index.vue' / / newly built by yourself

Then write the component in components

Components: {Hamburger, Nav / / self-defined}

Finally, it is used in template tamplete

However, when I checked the page, I found that the content of Nav/index.vue was not displayed in the page.

Then an error was found on cmd, saying that Nav was defined and not used.

Module Warning (from. / node_modules/eslint-loader/index.js):

Error: The "Nav" component has been registered but not used (vue/no-unused-components) at src\ layout\ components\ Navbar.vue:44:5:

43 | Hamburger

> 44 | Nav

| | ^ |

45 |}

After trying for a long time, I didn't know what the problem was, and then I thought about whether the initials were capitalized, so I tried it and found that it actually showed

But all the other components are in lowercase. I don't know why.

Vue declares a component, but does not show

A component is declared, but the page is not displayed, so this is the problem. Set

It turns out that we need to declare an instance of Vue and put our custom components in the tag.

This is the end of the article on "how to solve the problem that the vue component references another component that the component does not display". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to solve the problem that the vue component references another component and the assembly does not display". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Component question content knowledge page article navigation value side background uppercase header letter instance lowercase easy to operate article time easy to understand is in Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MySQL Shulou Technology Docker vpn