Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report